![]() ![]() | ||
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:
Select a control whose tab order you want to set.
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.
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.
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.
![]() ![]() | ||