View contents of this chapter

Control Focus

Only one control on a form can have the focus at any time. The first control with the focus is determined by the TabIndex property of each control on your form.

Play Sound Only those controls the user can interact with can receive the focus. For example, a label control cannot receive the focus.

Have a look at the following figure. Notice that the Show command button has the focus because it's highlighted by a dashed box. If the user pressed Enter in the following figure, the command button would trigger.

Figure 5.2

Play Sound You can press Tab or Shift+Tab to move focus to another control.

All the controls have a TabIndex property. When you place controls on a form, VB automatically sets the TabIndex property to 0, 1, and so on. Each new control is placed last in the tab order. You can make changes in the tab order at design time using the Properties window or at run time in code

Play Sound If you change the value of a control's TabIndex property to adjust the default tab order, Visual Basic automatically renumbers the TabIndex of other controls to reflect insertions and deletions.

 



© Universal Teacher Publications        INDEX Previous Screen Next Screen