Add and change the code in red.
Public Class MainForm
Private intRetry As Integer = 0
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
intRetry += 1
Dim pass As String = String.Empty
Dim checkPass As String = String.Empty
Dim counter
pass = PasswordTextBox.Text.ToUpper()
If intRetry < 3 AndAlso pass.Equals("MOMO") Then
If pass.EndsWith(checkPass) Then
messageLabel.Text = "The correct password was entered. Please click OK to continue."
End If
ElseIf intRetry >= 3 Then
MessageBox.Show("The correct password was not entered. Please try again", "Password", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
passwordTextBox.Focus()
End Sub
End Class