Validating event form close dating outside the box

16-Mar-2015 16:17

The form contains 3 buttons: if validation fails which, if I understand correctly, indicates that validation failed and the events following should be canceled, including closing the form, reverting data back to it's original state or even changing to a different control.

That's great and fine, but because of that, the revert and cancel buttons don't work unless the user fixes the validation problem first, which kind of defeats the purpose of a cancel button or revert button.

What I am wanting to do it perform this check on the object so it affected all of the existing instances and cancels the validating events when the form is closing. I have a textbox with a validating event listener to validate the content of the textbox against a regular expression.After the validation, if entered value is not proper,i am showing the messagebox and i am cancelling the event so that mouse cursor move back to the textbox which has improper value.Based on the return value you would either let the form close or cancel the closing of the form.I have a custom control that gets focus when the form is loaded.

What I am wanting to do it perform this check on the object so it affected all of the existing instances and cancels the validating events when the form is closing. I have a textbox with a validating event listener to validate the content of the textbox against a regular expression.After the validation, if entered value is not proper,i am showing the messagebox and i am cancelling the event so that mouse cursor move back to the textbox which has improper value.Based on the return value you would either let the form close or cancel the closing of the form.I have a custom control that gets focus when the form is loaded.How can i prevent the validation from taking place when the user hits the cancel button?