哪个电脑高手帮我修改这个程序

来源:百度知道 编辑:UC知道 时间:2024/05/28 07:46:16
jj = ("123456")
w = InputBox("登陆")
If jj = w Then
Print ("密码正确")
ElseIf y < 3 Then
Print ("密码错误")
GoTo 10
Else
Print ("关闭")
End If
我想这个程序只能输错3次,怎样加才合理,我是用VB的

Private Sub Form_Load()
Show
Dim jj As String
Dim w As String
Dim y As Integer
y = 0
jj = ("123456")
Do
y = y + 1
w = InputBox("登陆")
If jj = w Then
Print ("密码正确")
Exit Do
ElseIf y < 3 Then
Print ("密码错误")
Else
Print ("关闭")
End
End If
Loop
End Sub