0 out of 1 rated this helpful Rate this topic

How to: Set the Tab Order on Windows Forms

The tab order is the order in which a user moves focus from one control to another by pressing the TAB key. Each form has its own tab order. By default, the tab order is the same as the order in which you created the controls. Tab-order numbering begins with zero.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

To set the tab order of a control

  1. On the View menu, click Tab Order.

    This activates the tab-order selection mode on the form. A number (representing the TabIndex property) appears in the upper-left corner of each control.

  2. Click the controls sequentially to establish the tab order you want.

    NoteNote

    A control's place within the tab order can be set to any value greater than or equal to 0. When duplicates occur, the z-order of the two controls is evaluated and the control on top is tabbed to first. (The z-order is the visual layering of controls on a form along the form's z-axis [depth]. The z-order determines which controls are in front of other controls.) For more information on z-order, see Layering Objects on Windows Forms.

  3. When you have finished, click Tab Order on the View menu again to leave tab order mode.

    NoteNote

    Controls that cannot get the focus, as well as disabled and invisible controls, do not have a TabIndex property and are not included in the tab order. As a user presses the TAB key, these controls are skipped.

Alternatively, tab order can be set in the Properties window using the TabIndex property. The TabIndex property of a control determines where it is positioned in the tab order. By default, the first control drawn has a TabIndex value of 0, the second has a TabIndex of 1, and so on.

Additionally, by default, a GroupBox control has its own TabIndex value, which is a whole number. A GroupBox control itself cannot have focus at run time. Thus, each control within a GroupBox has its own decimal TabIndex value, beginning with .0. Naturally, as the TabIndex of a GroupBox control is incremented, the controls within it will be incremented accordingly. If you changed a TabIndex value from 5 to 6, the TabIndex value of the first control in its group automatically changes to 6.0, and so on.

Finally, any control of the many on your form can be skipped in the tab order. Usually, pressing TAB successively at run time selects each control in the tab order. By turning off the TabStop property, you can make a control be passed over in the tab order of the form.

To remove a control from the tab order

  • Set the control's TabStop property to false in the Properties window.

    A control whose TabStop property has been set to false still maintains its position in the tab order, even though the control is skipped when you cycle through the controls with the TAB key.

    NoteNote

    A radio button group has a single tab stop at run time. The selected button (that is, the button with its Checked property set to true) has its TabStop property automatically set to true, while the other buttons have their TabStop property set to false. For more information about grouping RadioButton controls, see Grouping Windows Forms RadioButton Controls to Function as a Set.

Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ
OMG... Just select a control first...
When I select a control on the form, the Tab Order appears automatically , and the problem that where is the Tab Order or why is the Tab Order not usable is solved.
View | Tab Order - it actually is on the View menu
Open a form in the designer. Select the Form ; Click the View menu item and notice that the Tab Order menu item appears just below the Full Screen menu item. You can toggle viewing the tab order of controls on the form via the View| Tab Order selection. $0$0 $0 $0Note that if you have superposed controls you only see the 'front' control; you'll have to separate superposed controls to set their tab order using View|Tab Order.$0 $0$0 $0 $0What's missing is an add-in/Tool that would, for instance, list all controls by name along with their tab order and then allow one to set tab order for all controls.$0
It isn't there...
I found this thread, regarding the tab order on WPF forms in VS 2010:

http://social.msdn.microsoft.com/Forums/en/vswpfdesigner/thread/38a7953e-6cff-40a6-abc9-8fa0f2a6f9a9

It states they were unable to complete this on schedule, so it isn't there.  Use the Tab Index property.  Now, if I could only find the Tab Index property.  Tab Stop = True.   Joy :-b

Workaround:
1. Edit the .rc file as a code/text file (select the dialog in the editor, then View-> Code). 
2. Reorder the dialog controls as you wish the tab order to be. 
It's on the Layout Toolbar but is not selectible
I can find it on the Layout toolbar but it is never selectible. I click on a control, multiple controls, the tab header, the Solutions Explorer name tag but it is never selectible.
Tab Order on Layout Toolbar
As previously mentioned, I also could not find the "Tab Order" feature on the "View" pull down menu, but I did find it on the "Layout" toolbar.  Right-click anywhere on a tool bar and choose "Layout"  It will be the last button on the right.
Tab Order in View Menu of VS2010
Sure there is - if you have the form itself selected as opposed to a control on the form.  Click the title bar of the form and the click on the View menu.
Not Correct
There is no Tab Order item in the View menu in VS2010