我正在使用文本框在 VB 中制作登录脚本。我的问题是通知用户有关尝试的消息框也不断循环并用完所有(3)次尝试。不知道出了什么问题。
这是我的代码:
Dim cor_pw As String = "1234"
Dim cor_us As String = "abcd"
Dim tries1 As Integer = 3
tries1 -= 1
Do
MsgBox("wrong combination, " & tries1 & " chances left to make it right.")
Loop Until textbox1.Text = cor_us And textbox2.Text = cor_pw Or tries1<= 0
If textbox1.Text = cor_us And textbox2.Text = cor_pw Then
MsgBox("Congratulations! That's Correct!")
Else
MsgBox("You've used all tries! " & tries1 & " chances left, good bye!")
Me.Close()
End If