However, both properties are listed as events in properties window. Cancel Event Args e) private void text Box1_Validated(object sender, System.private void text Box1_Validating(object sender, System. Event Args e) public bool Valid Email Address(string email Address, out string error Message) The biggest problem with validation on Win Forms is the validation is only executed when the control has "lost focus".I've read something about Validating Events, but I am not sure how can I use them. Validating Event When you change the focus by using the keyboard (TAB, SHIFT TAB, and so on), by calling the Select or Select Next Control methods, or by setting the Container Control.
Is there a "best practice" document/site for control validation in a Windows Forms application?But this doesn't work well if you're trying to make sure a user didn't leave a textbox empty by skipping over it.In my solution, when the user clicks the submit button for a form, I check each control on the form (or whatever container is specified) and use reflection to determine if a validating method is defined for the control. If any of the validations fail, the routine returns a failure and allows the process to stop.This solution works well especially if you have several forms to validate.Is there a simple way of triggering validating/validated event on the button? I tried placing textbox on the form and tabbing between button and textbox, but neither of those events get triggered.