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
这会返回“从字符串转换”“到'long'类型无效。”我想知道错误是什么以及如何解决它?我所看到的其他问题主要与分配不正确类型的变量有关,但我认为这不是问题。当所有变量都为空时发生。
谢谢!
答案 0 :(得分:2)
你想做什么。您想检查所有是""
吗?然后这样做:
If string.isNullOrEmpty(CustID) and _
string.isNullOrEmpty(FirstName) And string.isNullOrEmpty(SecondName) Then
MsgBox("Please enter a term to search by")
End If
或者您想检查一个是""
。然后这样做:
If string.isNullOrEmpty(CustID) orelse _
string.isNullOrEmpty(FirstName) orelse string.isNullOrEmpty(SecondName) Then
MsgBox("Please enter a term to search by")
End If