开发者

How to set which control gets the focus on application start

开发者 https://www.devze.com 2022-12-16 14:32 出处:网络
For a开发者_JAVA技巧 C# Windows Forms application, how do I set the default focus to a given control when my application starts?The one with the minimum tab index automatically gets the focus (assumin

For a开发者_JAVA技巧 C# Windows Forms application, how do I set the default focus to a given control when my application starts?


The one with the minimum tab index automatically gets the focus (assuming the TabStop property is set to true). Just set the tab indices appropriately.

By the way, Visual Studio provides a way to easily set tab indices by just clicking on the controls in the order you want. You can activate this feature by choosing "Tab Order" option in the "View" menu when you are in the form design view.

You can also manually give the focus to a control by calling its Select method when the form loads.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号