1
Reply

How Do I: Add a Control for a Form?

Gustavo

Gustavo

14 years ago
2k

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)