title: How to avoid following "If" conditions if the first "If" is true
body: <p>I want to make my first <code>If</code> to stop at <code>"Incorrect user and password"</code>, but it goes to the second and third <code>If</code> saying <code>"incorrect user"</code> and <code>"incorrect password"</code> after <code>"incorrect user and password"</code>.</p>
  
  <pre><code>Public Class Form1
      Dim numAttempts As Double = 0
  
      Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click
          Dim User As String = "ShaoHecc"
          Dim Password As String = "daedric123"
          Dim loginuser As String
          Dim loginpassword As String
          Dim wrong As String = False
  
          loginpassword = Val(txtpass.Text)
          loginuser = Val(txtuser.Text)
          txtpass.Text = loginpassword
          txtuser.Text = loginuser
  
          If txtuser.Text = User And
              txtpass.Text = Password Then
              MessageBox.Show("Access Granted!")
          ElseIf txtuser.Text = loginuser And
              txtpass.Text = loginpassword Then
              MessageBox.Show("Username and Password incorrect, " &amp; numAttempts &amp; " / 3 attempts left")
          End If
  
          If txtuser.Text = User = False Then
              MessageBox.Show("Username incorrect, you have " &amp; numAttempts &amp; " / 3 attempts left.")
              txtuser.Text = Nothing
          End If
  
          If txtpass.Text = Password = False Then
              MessageBox.Show("Password incorrect, you have " &amp; numAttempts &amp; " / 3 attempts left.")
              txtpass.Text = Nothing
          End If
  
          If numAttempts = 3 Then
              MessageBox.Show("Maxiumum number attempts reached, you have been denied access.")
              Application.Exit()
          Else
              numAttempts = numAttempts + 1
          End If
      End Sub
  End Class
  </code></pre>