vb 一个超基础的问题

来源:百度知道 编辑:UC知道 时间:2024/07/05 05:21:40
http://topic.csdn.net/u/20091102/13/3475c68a-f536-49eb-bc0b-acc8949a958e.html?32641

这个贴子..

Private Sub Command1_Click()
If Text1 = "潘安" Then
MsgBox "当然"
Else
MsgBox "扯蛋吧你"
End If

End Sub

如果我要再加几个帅哥.比如在text1里面输入刘德华的话

也是显示当然.应该在在if里面如何添加?谢谢

Private Sub Command1_Click()
If Text1 = "潘安" Then
MsgBox "当然"
ElseIf Text1 = "刘德华" Then
MsgBox "当然"
Else
MsgBox "扯蛋吧你"
End If
End Sub

'如果可选项比较多的时候,建议使用 Select Case 语句。当你水平再高一点要学会 or 和 and ,会更方便
Private Sub Command2_Click()
Select Case Text1
Case "潘安"
MsgBox "当然"
Case "刘德华"
MsgBox "当然"
Case "某某某"
MsgBox "当然"
Case Else
MsgBox "扯蛋吧你"
End Select
End Sub

if text1="潘安" or text1="刘德华" then
msgbox "当然"
else
msgbox "扯淡吧你"
end if
你要加多少,就用or 然后加上判断的就可以了

Private Sub Command1_Click()
If Text1.text = "" Then
MsgBox "请输入姓名"<