编程密码输入错误3次然后退出的问题(VB),哪错了?急求!

来源:百度知道 编辑:UC知道 时间:2024/07/01 06:34:09
要求错了弹出警告框,按重试再输入,按取消退出,3次重试仍错误退出!麻烦帮我看看,急求!

Private Sub Command1_Click()
Dim i%
Dim n%
n = 0
If Text2.Text <> "Gong" Then
i = MsgBox("密码错误", 5 + 48, "警告")
If i <> 4 Then
End
Else
Text2.Text = ""
Text2.SetFocus
n = n + 1
If n > 3 Then End
End If
End If
End Sub

Private Sub Command1_Click()
Dim i%
Static n%
If Text2.Text <> "Gong" Then
n = n + 1
i = MsgBox("密码错误", 5 + 48, "警告")
If i = 2 Or n = 3 Then End
Text2.Text = ""
Text2.SetFocus
End If
End Sub

Dim n%
n = 0
改:
const n%

If n > 3 Then End
改:
If n >= 3 Then End