We help IT Professionals succeed at work.

How do I trigger all Validating/Validated events on all controls on a form?

Medium Priority
Last Modified: 2010-04-16

I am using my Validated events to move data from my form to the class object containing my data.  When the "Save" button is clicked, I want to make certain that all the Validated events have been triggered.  There are some test fields that just have data put into them as a result of choices being made on other controls.

So I'd like to build a method that just triggers the Validating event for all the controls, and if the control validates, trigger the Validated event.

The method would look something like this:

static public void TriggerValidations(Control.ControlCollection pcb)
      foreach (Control ctl in pcb)
                // trigger Validating event
                // if control Validated without error
                         //trigger Validated event

Is this possible?
Watch Question

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.