英语翻译Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)Static i As IntegerIf KeyCode = 13 ThenIf (Text1.Text) = "abcd" ThenLabel2.Caption = "你已成功进入"ElseIf i < 3 Theni = i + 1MsgBox "口令错!请重新输入"Text1.SetFocu
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/30 03:09:05
英语翻译Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)Static i As IntegerIf KeyCode = 13 ThenIf (Text1.Text) = "abcd" ThenLabel2.Caption = "你已成功进入"ElseIf i < 3 Theni = i + 1MsgBox "口令错!请重新输入"Text1.SetFocu
英语翻译
Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)
Static i As Integer
If KeyCode = 13 Then
If (Text1.Text) = "abcd" Then
Label2.Caption = "你已成功进入"
ElseIf i < 3 Then
i = i + 1
MsgBox "口令错!请重新输入"
Text1.SetFocus
Else
MsgBox "你无权进入系统"
End If
End If
End Sub
英语翻译Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)Static i As IntegerIf KeyCode = 13 ThenIf (Text1.Text) = "abcd" ThenLabel2.Caption = "你已成功进入"ElseIf i < 3 Theni = i + 1MsgBox "口令错!请重新输入"Text1.SetFocu
Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)
'Text1的键盘按下事件
Static i As Integer '声明变量i
If KeyCode = 13 Then '如果按下回车
If (Text1.Text) = "abcd" Then '如果Text1中的内容是abcd
Label2.Caption = "你已成功进入" 'Label2显示
ElseIf i < 3 Then '如果i小于3
i = i + 1 'i增加1
MsgBox "口令错!请重新输入" '对话框
Text1.SetFocus 'Text1得到焦点
Else
MsgBox "你无权进入系统" '对话框
End If
End If
End Sub
'这个程序虽然执行起来是没有问题的,但是3次输入的限制是起不到作用的,可以改成下面这样
Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)
Static i As Integer
If KeyCode = 13 Then
If i < 3 Then
If (Text1.Text) = "abcd" Then
Label2.Caption = "你已成功进入"
Else
MsgBox "口令错!请重新输入"
Text1.SetFocus
End If
Else
MsgBox "你无权进入系统"
End If
i = i + 1
End If
End Sub