How do I compare two textboxes if they have text in them.

Posted on 2008-11-19
Last Modified: 2012-08-13
I have a text box called LastName and a MaskedTextBox for a date entry. I need to compare the two and if both textboxes have characters in them I need to generate a message. The following code is what I've tried and it doesn't work.
If LastName.Text IsNot Nothing And DOB.Text IsNot Nothing Then

    MsgBox("You can only search with Last Name or DOB!")

    Exit Sub

End If

Open in new window

Question by:rfgraham
    LVL 4

    Accepted Solution

    If LastName.Text <> "" And DOB.Text <> ""

    Will that work?
    LVL 6

    Expert Comment

    try using String.Empty

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now