CF - Set Focus to a specific control
- by no9
Hi !
I have a Form that has a panel with some textBoxes and checkBox that is outside the panel.
Every time the Form is loaded the checkBox has focus.
I have put en event handler when form loads and tried to set focus on first textbox instead having it on the checkbox.
this.Activated += new EventHandler(form_Activated);
in the method i try to set the focus on the first textbox in the panel
private void form_Activated(object sender, EventArgs e)
{
if (this.parametersPanel.Controls.Count > 0)
{
this.parametersPanel.Focus();
(this.parametersPanel.Controls[0]).Focus();
}
}
This does not work, can some1 help me pls?