Help i need to have 3 login attempts then the program will lock down but the message box shows up 3 times consecutively, it will close then pops out it will do this for 3 times then it closes ... help pleassseee :(
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim un, pw As String
Dim counter As Integer = 0
un = txtUsername.Text
pw = txtPassword.Text
Do
If un = "student" And pw = "21217" Then
Me.Hide()
CourseStudy.Show()
Else
counter = counter + 1
MsgBox("Try again", MsgBoxStyle.Critical, "Acess Denied")
txtPassword.Text = ""
txtUsername.Text = ""
End If
Loop While counter <= 2
Me.Close()
Form1.Close()
MessageBox.Show("Program exited, Try again", "Acess Denied")
End Sub