The ErrorProvider and Closing the Form

  • Thread starter Thread starter orekinbck
  • Start date Start date
O

orekinbck

Hi There

I am trying to incorporate the ErrorProvider into a form. I am using
the 'Validating' event on the text boxes and setting e.Cancel = true if
there is an error.

I also have an 'Exit' button that can be clicked at any time and it
will close the form (I needed to recursively loop all controls and set
CausesValidation = false).

So all is looking gr8, except when there is incorrect data in a text
box and the user clicks the X button in the top right corner (ie the
control box) - the user is stuck !

What workarounds are there for this problem ? We need some way to
acertain that the mouse is outside the client area I suppose ?

Thanks In Advance
Bill
 
Hi!
In the closing event of your form try to set e.cancel=false;

private void frmDemo_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
e.Cancel=false;
}
 
Back
Top