JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Setting Control Tab Order

Another call from the testing department. They've been going over your program with a fine-tooth comb and are asking about the keyboard interface. What does that mean? you ask. They explain that theoretically, according to Microsoft, users should be able to run all Windows programs with the keyboard alone. But that was archaic years ago, you say. Add it to your program, they say.

In Visual Basic, you can make controls accessible to the keyboard by setting their tab order. The user can move from control to control, highlighting the currently selected control, using the Tab key. But it's up to you to set the order in which control moves from control to control, and even whether or not a control can be reached with the Tab key.

To set the tab order of the controls in your program, follow these steps:

  1. Select a control whose tab order you want to set.

  2. Next, make sure the control's TabStop property is set to True. If this property is False, the user cannot reach the control using the Tab key.

  3. Now set the control's position in the tab order by setting its TabIndex property. The first control in the Tab order has a TabIndex of 0, the next a TabIndex of 1, and so on.

  4. When you run the program, the first control is highlighted; when the user presses the Tab key, the focus moves to the second control in the tab order, when they press Tab again, the focus moves to the third control, and so on.

That's all it takes—now you've given your program a keyboard interface.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor