title: How to automatically login with VB Login form code?
body: <p>Say username is <code>ADMIN</code> and password is <code>ADMIN</code>.
  It should be auto <strong>LOGIN</strong> and it's not showing <strong>FORM 3</strong>. What would the code be for Visual Basic. Is mine correct?</p>
  
  <blockquote>
    <p>My form output:</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/3tvHY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3tvHY.jpg" alt="Login form"></a></p>
  
  <blockquote>
    <p>Here's my example code:</p>
  </blockquote>
  
  <pre><code> Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      If TextBox1.Text &lt;&gt; "" And TextBox2.Text &lt;&gt; "" Then
          MsgBox("Invalid username and password, Please try again!", +vbExclamation, +vbOK)
  
  
      ElseIf TextBox1.Text = My.Settings.Username And
      TextBox2.Text = My.Settings.Password Then
          MsgBox("Login Successfuly! Good day.", +vbInformation, +vbOK)
          Form3.Show()
          Me.Hide()
  
      Else
          MessageBox.Show("Please complete the required fields.", "Authentication Error" + TextBox1.Text + TextBox2.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
  
      End If
  End Sub
  </code></pre>