老师要求输错三次密码后冻结,可是每次都是2次机会,求帮助!
Private Sub Command1_Click()
Dim i As Integer
If Me.Text1.Text = "usex" And Me.Text2.Text = "123456" Then
MsgBox "欢迎登陆中国工商银行!"
Me.Text1.Text = " "
Me.Text2.Text = ""
ElseIf i = 2 Then
MsgBox "您输入的错误已经达到三次,系统将自动锁定!"
Me.Text1.Text = ""
Me.Text2.Text = ""
Me.Command1.Enabled = False
i = 0
ElseIf i < 2 Then
MsgBox "你的用户密码输入错误,还有" & 2 - i & "次机会"
Me.Text1.Text = ""
Me.Text2.Text = ""
End If
End Sub
Private Sub Command1_Click()
Dim i As Integer
If Me.Text1.Text = "usex" And Me.Text2.Text = "123456" Then
MsgBox "欢迎登陆中国工商银行!"
Me.Text1.Text = " "
Me.Text2.Text = ""
ElseIf i = 2 Then
MsgBox "您输入的错误已经达到三次,系统将自动锁定!"
Me.Text1.Text = ""
Me.Text2.Text = ""
Me.Command1.Enabled = False
i = 0
ElseIf i < 2 Then
MsgBox "你的用户密码输入错误,还有" & 2 - i & "次机会"
Me.Text1.Text = ""
Me.Text2.Text = ""
End If
End Sub