Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 5, 1999

Set Tab Order in a Hurry

Setting up the control tab order can be unruly-a sore point with many VB developers. In fact, in Jeff Hadfield's recent editorial, "Five Things You Hate About VB6" [Editor's Note, VBPJ April 1999], it's listed as one of the top five things people hate most about VB.

I've never understood this; it's never been a big deal to me. But many people are shocked when I show them how I lay out tab orders, and are even embarrassed they didn't think of it themselves. I don't worry about the tab order until I've placed all the controls on the form, then I order them.

Now for the slam in the face: Think backwards. While viewing your form, click on the control you want to be the last control in the tab order. Highlight the TabIndex property in the Properties window and change it to zero. Now click on the control that you want to have the focus before that one, and repeat the process. Repeat this process until you reach the control that should have focus when the form opens.

Here's why this works: VB does most of the work for you. VB automatically reassigns the tab orders if you change the TabIndex property of a control. Because you started by setting the tab index of the last control first, VB increments the last control's tab index as you set the rest of the controls. It's a heck of a lot easier to set the tab index to zero while you're going through the order. I can rip through a form with more than 50 controls in about two minutes using this technique.

James Bragg
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date