Tab index does not work with controls in panels?

房东的猫 提交于 2019-12-05 04:36:12

Believe it or not, the panel ordering absolutely DOES affect the TabIndex. I have found that the easiest way to deal with tab ordering on a multi-panel form is to use View>Tab Order as suggested by LarsTech. Then once the tab ordering is visible, you'll be able to see how the panels affect the overall ordering of the controls contained in each panel. Next, left-click one at a time on the actual panels, in the order that you want the flow to go. You'll notice that it will then automatically sub-order the controls inside each panel, with the overall panel ordering be in the order that you specified. Once this is done you can then click on each control inside each panel to set a control's relative tab order inside a given panel.

Try using "View - Tab Order" in the Visual Studio designer and click each container and control in the order you want. The tab index of the parent container (panels) matters.

Setting TabStop to FALSE means it will skipped by when its turn comes in the Tab Order. Normally you would set TabStop for LABELs to FALSE and all other INTERACTIVE Controls to TABSTOP = True (unless the control is disabled off course).

Dont skip from Tab to Tab. Your TabStop and Tab Order ought to be something like the list below.

Name         Parent        TabOrder        TabStop
=======================================================
Form         -             0               -
TabStrip1    Form          1               True
Tab1         TabStrip1     2               True
Label1       Tab1          3               False
Textbox1     Tab1          4               True
Label2       Tab1          5               False
Combo1       Tab1          6               True

Tab2         TabStrip1     7               True
Label3       Tab2          8               False
Textbox2     Tab2          9               True
Label4       Tab2          10              False
Combo2       Tab2          11              True

Tab3         TabStrip1     12               True
Label5       Tab3          13               False
Textbox3     Tab3          14               True
Label6       Tab3          15               False
Combo3       Tab3          16               True

I have found that you have to look at EVERY tab index for each control and grouping of controls (group box, panel, whatever). Unlike Classic VB, .Net doesn't update all the other tab indices for you. You can have as many controls as you want with the same tab index on a form, panel, or other grouping type.

BTW, for those that posted the View - Tab Order menu item, thank you. I didn't know it was there and it helped me immensely to properly order a form I have with multiple nested group boxes. This was an excellent tool for reviewing the tab order. If you use this, be sure to pay attention to each level of nesting.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!