Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the tab order in VB.NET?

I have a bunch of buttons on a form and when the person presses TAB I want the focus of the controls move in a specific order. Does anyone know how to do this?

like image 237
Alex Gordon Avatar asked Oct 21 '09 20:10

Alex Gordon


People also ask

How do I set tab order in VB?

Tab order can be set in the Properties window of the designer using the TabIndex property. The TabIndex property of a control determines where it's positioned in the tab order. By default, the first control added to the designer has a TabIndex value of 0, the second has a TabIndex of 1, and so on.

How do I change the order of tabs in VBA?

You can change the tab order of the controls by pressing View > Tab Order). You can also right click the dialog box and choose Tab Order from the shortcut menu. In either case the Tab Order dialog box is displayed. To move a control select it and click the arrow keys either up or down.

How is tab order determined?

Control tab order is determined by the order in which controls are drawn on the screen. The first control that you draw is assigned a tab order of 1 , the next is given tab order number 2 , and so on.


2 Answers

If you have form with lots of control then manage tab index by below method:

  • Open form in design mode.
  • Click on “View” from toolbar --> “Tab Order” at bottom.

Example:

enter image description here

Then just click on controls one by one in order that you want to set tab order.

like image 158
Bhaumik Patel Avatar answered Oct 07 '22 01:10

Bhaumik Patel


You can do this in the Designer as well, see Setting the TabIndex property of many form controls in Visual Studio?

like image 44
stuartd Avatar answered Oct 07 '22 01:10

stuartd