Reputation: 1093
I am working in Windows Form framework of c# , i have developed a form consisting of two textboxes (name and address). Problem is when i start my application focus is on address rather then name, how can i change this settings? Thank you in advance.
Upvotes: 0
Views: 10778
Reputation: 67
I personally use the ActiveControl property. Never failed me as of today.
ActiveControl = Address;
Upvotes: 0
Reputation: 1459
Hope this ll help you. Select will change for user input
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBoxName.Select();
textBoxName.Focus();
}
}
Upvotes: 4
Reputation: 1978
Just set the Tab Index property of the textbox as 0. Otherwise you can set call the focus method on load event
Upvotes: 1
Reputation: 223187
In Form_Load
event call:
yourTextBox.Focus();
You may look at Control.Focus() on msdn
You may also look at this article to Set the Tab order if you don't want to use Focus()
Upvotes: 1