复制程式
dim wrongval as integer '定义wrongval 为integer
Dim username, password As String
Dim LoginSuccess As Boolean = False
wrongval = 0 '将wrongval 预设等于0
Do Until LoginSuccess
username = InputBox("Username Please")
password = InputBox("Password Please")
If username = "Peter" And password = "1234" Then
LoginSuccess = True
else
wrongval +=1 ' 判断如果不等于的话 则wrongval + 1
End If
if wrongval >3 then ' 判断如果错误次数超过3则秀出弹跳视窗
messagebox.show("已输入三次错误!!")
end if
Loop
MsgBox ("Login success")
不晓得你要的错误画面是什么 随便写了一段 你自己看看吧
有附加说明 有问题的话 可以PM询问~