VB程序设计,不知道哪写错了

来源:百度知道 编辑:UC知道 时间:2024/05/27 17:35:35
Private Sub Form2_load()
If Text2 = "剪刀" And Text1 = "石头" Then
Label5.Caption = "你赢"
ElseIf Text2 = "石头" And Text1 = "石头" Then
Label5.Caption = "平手"
ElseIf Text2 = "布" And Text1 = "石头" Then
Label5.Caption = "你输"
ElseIf Text2 = "剪刀" And Text1 = "剪刀" Then
Label5.Caption = "平手"
ElseIf Text2 = "石头" And Text1 = "剪刀" Then
Label5.Caption = "你输"
ElseIf Text2 = "布" And Text1 = "剪刀" Then
Label5.Caption = "你赢"
ElseIf Text2 = "剪刀" And Text1 = "布" Then
Label5.Caption = "你输"
ElseIf Text2 = "石头" And Text1 = "布" Then
Label5.Caption = "你赢"
ElseIf Text2 = "布" And Text1 = "布" Then
Label5.Caption = "平手"

End If
End Sub

哪错了哟,la

你放在
Form2_load()
做什么

那个时候 程序刚运行

你的text里边还什么都没有呢

你弄个按钮 放在按钮里边

呵呵。用不着这么复杂吧?

Private Sub Command1_Click()
If Text2 = "剪刀" And Text1 = "石头" Then
Label5.Caption = "你赢"
ElseIf Text2 = "石头" And Text1 = "石头" Then
Label5.Caption = "平手"
ElseIf Text2 = "布" And Text1 = "石头" Then
Label5.Caption = "你输"
ElseIf Text2 = "剪刀" And Text1 = "剪刀" Then
Label5.Caption = "平手"
ElseIf Text2 = "石头" And Text1 = "剪刀" Then
Label5.Caption = "你输"
ElseIf Text2 = "布" And Text1 = "剪刀" Then
Label5.Caption = "你赢"
ElseIf Text2 = "剪刀" And Text1 = "布" Then
Label5.Caption = "你输"
ElseIf Text2 = "石头" And Text1 = "布" Then
Label5.Caption = "你赢"
ElseI