title: Microsoft Visual Studio 2013 Confirm Password TextBox
body: <p>Right so I want a password textbox and a confirm password textbox but I am unsure how to set these up correctly.</p>
  
  <p>I have the following:</p>
  
  <pre><code>    // This is where the user will enter the password for the product owner they wish to add.
      private void textBoxPassword_TextChanged(object sender, EventArgs e)
      {
          // Each character of the password will display as an asterisk.
          textBoxPassword.PasswordChar = '*';
          // Control to allow a max password length of 15 charachers.
          textBoxPassword.MaxLength = 15;
      }
  
      // This is where the user will re-enter the password for the product owner they wish to add.
      private void textBoxConfirmPassword_TextChanged(object sender, EventArgs e)
      {
          // Each character of the password will display as an asterisk.
          textBoxConfirmPassword.PasswordChar = '*';
          // Control to allow a max password length of 15 charachers.
          textBoxConfirmPassword.MaxLength = 15;
          // If statements to ensure that the passwords are the same.
          if (textBoxPassword.Text != textBoxConfirmPassword.Text)
          {
              MessageBox.Show("Passwords do not match.");
              textBoxConfirmPassword.Focus();
              return;
          }
      }
  </code></pre>
  
  <p>It works okay up to a point. The only problem is that as soon as I begin typing in the confirm password field, the "Passwords do not match" message displays after I enter every character. I only want it to display at the end of the string.</p>
  
  <p>I'm sure the solution is simple but I'm self teaching myself how to use Visual and I can't find the answer.</p>