• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

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

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

0
rfgraham
Asked:
rfgraham
1 Solution
 
whsumCommented:
If LastName.Text <> "" And DOB.Text <> ""

Will that work?
0
 
carlsiyCommented:
try using String.Empty
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now