vb中在一个文本框中输入密码,怎样限制只能输入3次,3次错误后就不能在输入了

2024-10-31 13:30:07
推荐回答(1个)
回答(1):

Dim errorcount As Integer
Private Sub Command1_Click()
If LCase(Txtuser.Text) = "abc" And txtpass.Text = "123" Then
Form2.Show
Unload Me
Else
errorcount = errorcount + 1
MsgBox "密码桐磨不正确,请重新输入"
Txtuser.SelStart = 0
Txtuser.SelLength = Len(Txtuser.Text)
Txtuser.SetFocus
End If
If errorcount = 3 Then
MsgBox "你已经输错3次局手斗,系统将自动退出"
End
End If
End Sub
我在书找了给薯脊你打印过来的,希望对你有帮忙~~