Tabindex is driving me nuts!!!

K

Kevin

I'm trying hard to like Visual Basic 2006. Lots of things it does alot
easier and better than VB6. But some things it does not. And one thing
I can't understand their reasoning behind is the Tabindex property.

How can two controls on the same form have the same Tabindex? If I add
a control in the middle, I have to go through all of them again--it
won't just bump up the count like VB6 would. In the Beta, you could
click on View ----> Tab Order and just click through the controls and
set the tab order. It didn't make it into the final version (if it
did, I can't find it).

Also, I have about 100 controls on one form (half of them labels) and
one multi-line textbox has Tabindex of 27, but pressing Tab key, it
doesn't receive focus until the end. WHY?

Is there a better way to do this or is everyone as frustrated as me?
 
C

Carlos J. Quintero [VB MVP]

Hi Kevin,

While in VB6 tabindex was linear (0, 1, 2,....) in .NET it is hierarchical.
So, if you have a GroupBox1 with a TabIndex 1 and inside a checkbox with
TabIndex 0, the tabindex of the checkbox is really 1.0. This new design
causes, for example, that even if the tabindex is not set correctly for the
controls of a container, at least the focus won´t go far away once the focus
goes to one of the controls of the container.

Although the tabindex of a control with 3 containers is really something
like 1.3.2.2, you can change only the last digit, so the properties window
only shows that last digit. For that reason you can have two controls with
(apparently) the same tabindex (they can have actually the same tabindex if
they have no containers).

The View \ Tab Order menu is still there but for some (wrong) reason MS
makes it to appear only when a form has the focus in the designer window,
not when a control inside the form has the focus. You will notice that the
Tab Order assistant shows the whole tabindex 1.3.2.2 value for each control.

All that said, if you don´t mind using a comercial tool, my MZ-Tools add-in
below provides two features that can solve your problem in a couple of
seconds:

- A TabIndex Assistant that show the hierarchy of controls and its full
tabindex value. It has an "Automatic" button to set the correct tabindex
with just one click (no need to click on each control to set its tabindex).
The assistant also shows you the controls with a wrong tabindex. You have a
screenshot here:

http://www.mztools.com/v5/features.htm#TabIndexAssistant

- The Intelligent Design Mode: when activated, it sets automatically (among
other things) the Tabindex value for a control when you drop it on a form,
and it readjust the Tabindex values as you move controls inside a form.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
K

Kevin

Yeah, I finally figured out the missing menu item when I clicked on
the Form. It was easy to figure out once I could see everything.
Thanks for the reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top