# Re: 回圈问题或 . . . . .

Posted by VB新手 on February 01, 1999 at 13:23:43:

In Reply to: 回圈问题或 . . . . . posted by 初学者 on February 01, 1999 at 03:00:13:

: 我是VB初学者，请问要如何在一个表单上设定输入密码及帐号，输入错误时
: 显示一个msgbox后，再回到该表单，错三次后就跳到Error Form，
: 正确的话就跳到Successful Form。

: 我想破头了都想不出来，可以帮帮我吗？？谢谢！！！

Dim InputTimes, YPress As Integer
Dim PassWord$

Private Sub Form_Load()
PassWord$ = "123456"
Timer1.Interval = 1
End Sub

Private Sub Text1_Change()
Timer1.Interval = 1
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
YPress = KeyCode
End Sub

Private Sub Timer1_Timer()
If YPress = 13 And Text1.Text <> "" Then
If Text1.Text = PassWord$ Then
Retr = MsgBox("密码输入正确！", 0, "提 示")
Timer1.Interval = 0
Else
InputTimes = InputTimes + 1
If InputTimes = 3 Then
Rete = MsgBox("你不是合法使用者！", 0, "警 告")
Else
Retw = MsgBox("密码输入错误！", 0, "警 告")
End If
End If
End If
If Retw = 1 Then
Timer1.Interval = 0
Text1.TabIndex = 0
Text1.Text = ""
End If
If Rete = 1 Then End
End Sub
....这是在章鱼工作室的source...

Follow Ups: