title: Validate input empty textbox c#
body: <p>I am trying to validate textboxes for empty values. If the textbox is empty and loses focus, an error has to show and the textbox has to receive focus again.</p>
  
  <p>Reading about this I came across the Validating event, which can be cancelled through e.Cancel. However when I try to do this, I get an error message.</p>
  
  <p>My code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private void CheckInput(CancelEventArgs e, TextBox tb)
  {
     ErrorProvider error = new ErrorProvider();
     if (!string.IsNullOrEmpty(tb.Text))
     {
        error.SetError(tb, "*");
        e.Cancel = true;
     }
  
     else
     {
        error.SetError(tb, "");
     }
  }
  
  private void tbTitel_Validated(object sender, CancelEventArgs e)
  {
      CheckInput(e, tbTitel);
  
  }
  </code></pre>
  
  <p>And the error I get is the following:</p>
  
  <p><strong>Error 1   No overload for 'tbTitel_Validated' matches delegate 'System.EventHandler'</strong>    </p>
  
  <p>How can I fix this?</p>