How Do I: Put this routine in a class?
Hello:
I have the following code in mty programs. I would like to put it in a class or something and just call it. So I can get rid of the redunda nt code in all my forms. Any suggestions?
I have tried to put it in a class, but it gives me an error on the 'GetNextControl'.
public FormICEPack()
{
InitializeComponent();
//
Control TheControl = GetNextControl(null, true);
while (TheControl != null)
{
if (TheControl.GetType().Name == "TextBox")
{
TheControl.Enter += new EventHandler(Object_Enter);
TheControl.Leave += new EventHandler(Object_Leave);
TheControl.Click += new EventHandler(Object_Click);
TheControl.MouseHover += new EventHandler(textBox_MouseHover);
TheControl.MouseLeave += new EventHandler(textBox_MouseLeave);
}
TheControl = GetNextControl(TheControl, true);
}
}