Gustavo

Gustavo

  • NA
  • 1.3k
  • 454k

How Do I: Add a Control for a Form?

May 23 2010 11:44 AM

Hello:
 
I have a Class that adds Event Controls to all my Forms.
Now I would like to add a Control for the Form on other Events. Below is the code I have now.
How do I set up the Control for the Form at Load or other events?
Control TheControl = TheForm.GetNextControl(null, true);
while (TheControl != null)
{
TheEvent = TheControl.GetType().Name;
switch (TheEvent)
{
case "Button":
TheControl.Enter +=
new EventHandler(ButtonEnter);
TheControl.Leave +=
new EventHandler(ButtonLeave);
TheControl.MouseHover +=
new EventHandler(TextBoxMouseHover);
TheControl.MouseLeave +=
new EventHandler(TextBoxMouseLeave);
break;
case "CheckBox":
...
 
 

Answers (1)