How to cancel a form's Error Provider?

  • Thread starter Thread starter ~~~ .NET Ed ~~~
  • Start date Start date
N

~~~ .NET Ed ~~~

Something I never liked about the error providers in Windows Forms is that
sometimes they get on the way. But pershaps there is something I do not
know.

I have several textboxes and comboboxes in my windows form. These have an
associated Error provider which is used in conjunction with the control's
Validating event. So far so good.

However, if the user decides to press the Cancel button and abandon the form
then the error provider will not let the user abandon the form until all
items validate correctly!!! is there a way I can have my Cancel button click
event be fired in spite of the ErrorProvider ?

Thanks in advance
Emilio
 
Aha! after sifting through a lot of useless results I found an article in
examcram2.com which was not only concise and informative but also contained
the solution to the problem. Here it is:

Set the CausesValidation property of the CANCEL button to FALSE. Then the
user can abort data input and validation is not fired. The SAVE button
however will keep the property set to TRUE for obvious reasons.
 
Back
Top