TabIndex

This property returns and sets the tab order of objects within their parent form.

Syntax

object.TabIndex [= index]

Parameters

object
Object expression that evaluates to a control.
index
Integer from 0 to (n–1), where n is the number of controls on the form that have a TabIndex property. Assigning a TabIndex value of less than 0 generates an error.

Remarks

By default, Visual Basic for Windows CE assigns a tab order to controls as you draw them on a form, with the exception of the Menu, Timer, Line and Shape controls, which are not included in the tab order. At run time, invisible or disabled controls and controls that cannot receive the focus (Frame and Label controls) remain in the tab order but are skipped during tabbing.

Each new control is placed last in the tab order. If you change the value of a control's TabIndex property to adjust the default tab order, Visual Basic for Windows CE automatically renumbers the TabIndex of other controls to reflect insertions and deletions.

The ZOrder method does not affect the TabIndex property.

A control's tab order does not affect its associated access key. If you press the access key for a Frame or Label control, the focus moves to the next control in the tab order that can receive the focus.

When loading forms saved as ASCII characters, controls with a TabIndex property that are listed in the form description are automatically assigned a TabIndex value. In subsequently loaded controls, if existing TabIndex values conflict with earlier assigned values, the controls are automatically assigned new values.

When you delete one or more controls, you can use the Undo command to restore the controls and all their properties except for the TabIndex property, which cannot be restored. TabIndex is reset to the end of the tab order when you use Undo.