I fear from loop statements that's why I cannot figure this thing out. I understand the concept put I do not have bigger picture. Here I would like to close the application after the person try 3 times putting the wrong password.
Public Class MainForm Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click Me.Close() End Sub Private Sub PasswordTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PasswordTextBox.Enter PasswordTextBox.SelectAll() End Sub Private Sub PasswordTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles PasswordTextBox.TextChanged messageLabel.Text = String.Empty End Sub Private Sub verifyButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles verifyButton.Click Dim pass As String = String.Empty Dim checkPass As String = String.Empty Dim counter pass = PasswordTextBox.Text.ToUpper() 'I know this part is wrong Do counter = counter + 1 If counter > 2 Then Exit Do End If Loop If pass Like "MOMO" Then If pass.EndsWith(checkPass) Then messageLabel.Text = "The correct password was entered. Please click OK to continue." End If Else MessageBox.Show("The correct password was not entered. Please try again", "Password", _ MessageBoxButtons.OK, MessageBoxIcon.Information) End If passwordTextBox.Focus() End Sub End Class