我做出选择后,我的输入框不会清除。我做错了什么或者写得好些。
Do
Response = True
inputData = InputBox("Type 'ID' for Impaired Driving/e-Lap, or 'OP' for Occupant Protection:", "Impaired/e-Lap or Occupant Protection Selection")
If inputData = "ID" Then
FrmImpairedDriving.Show
Else
Response = False
End If
If inputData = "id" Then
FrmImpairedDriving.Show
Else
Response = False
End If
If inputData = "OP" Then
FrmOccupantProtection.Show
Else
Response = False
End If
If inputData = "op" Then
FrmOccupantProtection.Show
Else
Response = False
End If
Loop Until Response = True
答案 0 :(得分:2)
尝试:
Dim inputData as String = InputBox("Type 'ID' for Impaired Driving/e-Lap, or 'OP' for Occupant Protection:", "Impaired/e-Lap or Occupant Protection Selection")
也会查看Select Case
。它比使用如此多的if语句更容易。还可以使用Ucase
进行比较,而不是为同一响应尝试两次。