开发者

Windows Forms TabIndex not following the Indexes

I have a Windows Forms application and on one of the forms there is a TabControl and inside one of the tabs I have multiple Textboxes with each of them having the TabIndex set to values 1->9. When the form is loaded, one of the textboxes (with tabIndex 5) is given focus and the textbox with TabIndex 6 is disabled. When the user fills out the first field and hits tab the focus does not go to the next t开发者_如何学Goextbox instead it goes to the Save Button which is outside the TabControl and has a TabIndex of 13. I can't figure out why the textbox (With Index 7 that is below and to the left of the one with Index 5) doesn't get the focus.


When you have the form in design mode, in 'View' menu, there is an option 'Tab Order' that allows you to set tab order by just clicking on controls in the sequence you like. It also helps you in visualising the tab order for controls in other containers too (like controls in a panel).

This way you can not only see if the controls have right order but also if thet have right parent (container) too.

Vijay


I realize how old this thread is, but I am sure someone will come across it again. The reason is if you have controls in GroupBoxes, the GroupBox index could be influencing the general flow. Ensure you number the GroupBox in sequential order and then sub-index the controls within the groups and you should be fine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜