title: Closing a Windows Form, using the Close Window button, when a Validation Message is showing
body: <p>I have a Windows form that has a validation event on a textBox so that if the value of that TextBox is a value that already exists it triggers a validation error.</p>
  
  <pre><code>    private void txtUsername_Validating(object sender, CancelEventArgs e)
      {
          var alreadyExists = _logic.UserIdExists(txtUsername.Text.Trim());
  
          if(alreadyExists)
          {
              errorProvider1.SetError(txtUsername, "This Userid already exists, please choose an alternative");
              e.Cancel = true;
          }                       
      }
  
      private void txtUsername_Validated(object sender, EventArgs e)
      {
          errorProvider1.SetError(txtUsername, "");
      }
  
  
          this.txtUsername.Validating += new System.ComponentModel.CancelEventHandler(this.txtUsername_Validating);
          this.txtUsername.Validated += new System.EventHandler(this.txtUsername_Validated);
  </code></pre>
  
  <p>This results in an error image appearing next to that textBox along with a tooltip error message.</p>
  
  <p>If I try and close the application, using the Close button at the top of the window, at this time I cannot as the above Event keeps firing even when I try and close the window (due to me taking focus away from the Text box).</p>
  
  <p>Is there a way of closing the window, without resorting to creating an additional Close button on the form?</p>