Access Keys with Labels

There is a very simple trick you can perform with labels and text boxesthat will help users who like to use the keyboard instead of the mouse.Notice the underlines in the label controls. By pressing the Alt key incombination with any of the underlined keys, the cursor will jump to thetext box next to this label. For example, pressing Alt-F will move to thetext box next to First Name, and pressing Alt-C will move the cursor tothe City text box. To make this happen, set a TabIndex property like this: Label Text Box Prompt Control Control First Name 0 1 Cust. Type 2 3 Last Name 4 5 Street 6 7 and so on…. Label controls cannot receive the focus. When VB detects that you havepressed an Alt-key combination that corresponds to a label, the focus isset to the next control in the tab order that can take the focus. Makingthe TabIndex property of the text box one greater than the label controlwill cause the text box to become active when the key combination for thelabel is pressed.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: