如何在vb.net编码中限制用户登录三次以上

如何在vb.net编码中限制用户登录三次以上,vb.net,Vb.net,如何修改以下代码以限制用户三次登录尝试 Public Class Form3 Dim Attemp As Integer = 0 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.Text = "1" And TextBox2.Text = "1" Or TextBox1.Text = "2" And Te

如何修改以下代码以限制用户三次登录尝试

Public Class Form3
    Dim Attemp As Integer = 0
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "1" And TextBox2.Text = "1" Or
           TextBox1.Text = "2" And TextBox2.Text = "2" Then

            MsgBox("You are Now Logged In as User Rights", MsgBoxStyle.Information, "Login")
            Form5.Show()
            Close()

        Else
            If TextBox1.Text = "" And TextBox2.Text = "" Then
                MsgBox("No Username and/or Password Found!", MsgBoxStyle.Critical, "Error")
            Else
                If TextBox1.Text = "" Then
                    MsgBox("No Username Found!", MsgBoxStyle.Critical, "Error")
                Else
                    If TextBox2.Text = "" Then
                        MsgBox("No Password Found!", MsgBoxStyle.Critical, "Error")
                    Else
                        MsgBox("Invalid Username And/Or Password!", MsgBoxStyle.Critical, "Error")
                    End If
                End If
            End If
        End If
    End Sub
End Class

您必须在最后一个
结束if
之前添加类似
trunt=trunt+1
的内容。然后,您可以使用
检查第一个
中的
尝试
变量

如果(尝试<3和((TextBox1.Text=“1”和TextBox2.Text=“1”)或(TextBox1.Text=“2”和TextBox2.Text=“2”)),则是第一部分。我已经写了上面的另一部分了。