The ErrorProvider and Closing the Form

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
 
G

Guest

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top