0

I need to give the focus to a specific textbox when the application is launched.

I'm using this piece of code:

private void myForm_Load(object sender, EventArgs e)
{
    myTextbox.select()
}

It actually works. But is this the correct way to achieve my goal?

4

2 回答 2

0

像这样使用它:

mytextbox.Focus();

或者,您可以将该文本框上的选项卡索引设置为 0。

于 2013-05-06T09:29:49.263 回答
0

TextBox1.Focus() is the best way to select a Textbox in a Windows Forms application.

于 2013-05-06T11:21:05.653 回答