Only one message box is popped up after validating the 2 validations
<pre><code>abstract class User
{
    public string Username;
    public string Password;

    public virtual bool Validate(string username, string password)
    {
        Username = "";
        Password = "";
        if (password == Password &amp;&amp; username == Username)
        {
            MessageBox.Show("Incorrect password or username");
            return true;
        }
        else
        {
            return false;
        }

    }
</code></pre>

<p>form code:</p>

<pre><code> private void btnSubmit_Click(object sender, EventArgs e)
    {
      UserAdmin admin = new UserAdmin();
      UserEmployee empp = new UserEmployee();
      bool validateAdmin =  admin.Validate(txtUsername.Text, txtPassword.Text);
      bool validateEmpp  = empp.Validate(txtUsername.Text, txtPassword.Text);

      if (validateAdmin==true || validateEmpp == true )
      {
          this.Hide();
          // Create a new instance of the options class
          Options opt = new Options();
          opt.Closed += (s, args) =&gt; this.Close();
          // Show the settings form
          opt.Show();
      }
</code></pre>

<p>When the first validation is false it keeps checking the second validation as well.By doing so 2 message boxes are being popped up.</p>

<p>EDIT:
Can you show only one message box instead of 2? it only shows the message box if the username or password is incorrect</p>