How to set focus to a text box on windows form load?

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

I want to set focus to a text box on a C# windows form when the form loads.
How can I do this? I want the cursor to be in this text box when the form
loads so the user can just start typing. Below is what I have so far:

private void County_Load(object sender, EventArgs e)
{
txtCounty.Focus();
}

Thanks for the help
 
Bear with me as I am new to C# (been a DBA for 10 years). How would I do
that in the show event? Thanks.
 
I want to set focus to a text box on a C# windows form when the form loads.

Make the text box the first item in the tab order. Or, more specifically,
the first focusable item in the tab order. Hopefully there's a label in
front of the text box with an accelerator, so make its tab index 0 and the
text box 1.
 
Back
Top