devxlogo

Access Keys with Labels

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.

See also  5 Ways to Improve Customer Experience
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist