Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

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


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?
0
FrancineTaylor
Asked:
FrancineTaylor
1 Solution

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now