Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Tab Order

The user can move the focus from control to control by pressing Tab (or Shift+Tab to move the focus backward). If you place eight controls on an application's form, what focus order will result? In other words, as the user presses Tab, will the controls get the focus from a left-to-right or from a top-to-bottom order?

VB sets the default focus order in the order you place controls on the form. Therefore, if you place the top control first and the bottom control second, and then insert a third control in the middle of the form, the focus order will not move down the form in the order the user probably expects.

You don't always place controls on a form in the same order in which you want to set the focus. Therefore, controls that can receive the focus support a property called the TabIndex property. The first control in the focus order has a TabIndex property of 0, the second control in the focus order has a TabIndex of 1, and so on. If you place controls on the form and then later want to modify the focus order, you need to change the TabIndex property values of controls.

Share ThisShare This

Informit Network