Dim CustID As String = txtSrchCustID.Text
Dim FirstName As String = txtNewCustFName.Text
Dim SecondName As String = txtNewCustSName.Text
If CustID And FirstName And SecondName = "" Then
MsgBox("Please enter a term to search by")
EndIf
This returns "Conversion from string "" to type 'Long' is not valid." I was wondering what the error is and how it's possible to fix it? The other questions that I've looked at were mostly to do with variables assigned incorrect types, but I think that isn't the issue. It occurs when all of the variables are empty.
Thanks!
What do you want to do. Do you want to check of all of them are "". Then do this:
If string.isNullOrEmpty(CustID) and _
string.isNullOrEmpty(FirstName) And string.isNullOrEmpty(SecondName) Then
MsgBox("Please enter a term to search by")
End If
Or do you want to check if one of them are "". Then do this:
If string.isNullOrEmpty(CustID) orelse _
string.isNullOrEmpty(FirstName) orelse string.isNullOrEmpty(SecondName) Then
MsgBox("Please enter a term to search by")
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With