Tab page automatically selecting first control

  • Thread starter Thread starter Lance Johnson
  • Start date Start date
L

Lance Johnson

I would like when I select a tab page for it to default to the first control
automatically. This seems like it wouldn't be hard, but I can't seem to get
it to do that easily. So if I were to click on a tab page, I would like to
see the cursor in the first control of the tab order. Any help on this is
appreciated.

Lance Johnson
 
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

if (tabControl1.SelectedTab.Controls.Count > 0)

tabControl1.SelectedTab.Controls[0].Focus();

}



Pay attention to the order you create in design time the controls.

Hope that helps.
 
Thanks for the info. What if I created the controls in a different order
but I set the tab order up correctly. Is there any way for it to select the
first item in the tab order?

Lance Johnson
 
Back
Top