Easy one about supressing validation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is regarding VS 2003 Windows forms.

I have TextBoxes which use the Validating event when the user shifts focus.
When the user closes down the form using the red cross in the top left
corner, validation still takes place if a TextBox has focus.

I have used this in the Validating handlers:

If(this.ActiveControl==btnExit)

return;

to supress validation if the Exit button is cleared, but how do I apply this
to the red cross on the form?

An answer other than "don't show the red cross" would be much appreciated.
 
Tried that, but the Validating event is called before the closing event. I
need the Validating event to recognise that the red cross was clicked and
tell it to return out of the Validating handler.
 
Back
Top