Question How to skip validation of active control when form's close button is clicked.

dineshkumaar

Member
Joined
Jun 5, 2009
Messages
21
Programming Experience
10+
Hi everybody.

Is there any way to skip a the validating event of the active control when the close button of the form is clicked. It is very annoying when user wants to close the form, but due to the validate event of the active control, it asks for the valid input. The user is forced to give valid input to close the form. I have searched a lot for this on net but no any proper solution could be found.

Thanks
Regards

Dinesh Kumaar
 
Hi Bobby

I mean to say that suppose I have a textbox which has the current focus on the form and it has a validating method to check if the textbox is not empty. If it is empty, it shows a error message and remains in the textbox. Now problem is that some times user wants to close the form. When I close the form, it checks the validation and give the error message. this forces user to type in some thing in the textbox to close the form.

I want that if user clicks on the cose button then the validing method should be skipped so that the form is closed.

Thanks for your reply
 
You did not understand my question. The Active (Focused) Textbox Control which has the validating method and when you click on form's close button, it will fire its (Textbox's) Validating event first and then the form's closing event will occur.

Regards
Thanks
 
So you have the validation set up so the TB can't lose focus unless it meets the criteria?

No wonder the user can't close the form without valid data in the TB. What you should do is allow whatever data is in the TB to be left there and in the button that's clicked that does something with the information is where you Invalidate the TB's and other controls.
 
Back
Top