John Cassell
Well-known member
- Joined
- Mar 20, 2007
- Messages
- 65
- Programming Experience
- Beginner
Hi There,
I am just getting my head around using Select Case instead of multiple IF statements but I am struggling to find a way around this one..
For simple purposes, I have two text boxes on my form txtbox1 and txtbox2.
I need for the code to say "If txtbox1 or txtbox2 are blank then tell me to put something in both boxes otherwise tell me something happened that I wasn't expecting.."
Here is my code:
but this gives me the error 'Conversion from string "" to type 'Boolean' is not valid.'
can anyone help please?
Thanks
John
I am just getting my head around using Select Case instead of multiple IF statements but I am struggling to find a way around this one..
For simple purposes, I have two text boxes on my form txtbox1 and txtbox2.
I need for the code to say "If txtbox1 or txtbox2 are blank then tell me to put something in both boxes otherwise tell me something happened that I wasn't expecting.."
Here is my code:
VB.NET:
Select Case txtbox1.Text
Case "" or txtbox2.Text = ""
MsgBox("Please enter something in BOTH boxes.")
Case Else
MsgBox("I'm sorry something has happened which I don't have an answer for!")
End Select
but this gives me the error 'Conversion from string "" to type 'Boolean' is not valid.'
can anyone help please?
Thanks
John