Problem solve Get help with specific problems with your technologies, process and projects.

Set the focus on a text field based upon input criteria instead of manually clicking or tabbing over

How can I set the focus on a text field based upon input criteria, instead of manually clicking in desired field or tabbing over to it?
You can do this using the ActiveControl property of the Form or Control class. For example, the following Load event handler sets the active control to be the second TextBox on the Form instead of the first TextBox control:

void Form1_Load(object sender, EventArgs e) {
  this.ActiveControl = textBox2;

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.