Validating inputs with a Cancel button

Published 06-09-2005 9:34 AM | jokiz

I have seen a number of posts like this on newsgroups and it is trivial especially for developers who misuse the events of normal WinForms controls. 

First are those who use the inefficient TextChanged event of the Windows Forms Textbox for validating the user’s input.  Second are those who use the LostFocus and Leave events.

The ideal event to utilize in validating inputs is the Validating event in combination with the Validated event for after validation processing.  This way, one can just set the CausesValidation of the Cancel button to false in order to suppress validation of any controls.

Comments

# Can i drink alcohol if i m taking amoxicillin. said on April 17, 2008 3:57 PM:

Infant amoxicillin reactions.

# Ephedrine. said on April 17, 2008 6:20 PM:

Ephedrine. Ephedrine effects. Ephedrine faq. Ephedrine and pregnancy. Danger of ephedrine. Ephedrine pills. Brewing your own ephedrine. Mini thin ephedrine.