Visual Studio Form Design : Maintaining Tab Order

I have a form with 25-30 fields on it, as well as a tab control with 5 tab pages, each with 10 - 30 controls on them.

If I add a control to the main form, what is the easiest way to ensure that it is placed in the proper place in the tab order? Obviously, I can use the form designer and "View", "Tab Order" and then go through and clicking on each and every control in order. Is there an easier way?

So far, the best I have found as above, except that I start at the new control, and click on it until it has the correct tab order number, then go through each and every remaining control in order.

The same question applies to adding a control to one of my tab pages. So far, the best procedure I have found is to select the target tab page PRIOR to using "View", "Tab Order", and then proceed as above but only dealing with controls within the  tab page.

Any better ideas?

Thanks,
David
LVL 11
anyoneisSoftware DeveloperAsked:
Who is Participating?
 
vb_jonasCommented:
Indeed! Might be a good reason to learn how to program add-ins in the VS-environment. If I do, and I succeed, I will for sure send the solution to you.
0
 
vb_jonasCommented:
Well, if you insert a control that should be number 5 in the tab order you can change the tab index to number 5 and all the old tab indexes from 5 and up will increase by one.
0
 
anyoneisSoftware DeveloperAuthor Commented:
that is not what is happening for me. I end up with two controls with TabIndex == 5. The tie, as I tab,  seem to be broken using the z-order - whoever is highest is tabbed to first.


0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
vb_jonasCommented:
The controls on each tab page (container) has their own tab order.
0
 
anyoneisSoftware DeveloperAuthor Commented:
vb_jonas: >>The controls on each tab page (container) has their own tab order.

Yes, that is why I said to select the tab page (that the control is added to) BEFORE doing the "View", "Tab Order".  Otherwise, you will change the tab order of the Tab Control itself when you try to select a tab.

David
0
 
vb_jonasCommented:
Which version of VS do you use?

In VS 2005 (and I recently tried similar thing in VS 2003) I have a form with one tabcontrol with 3 tabs, on the first tab I have 10 controls, when I wiev tab order, they have the Tab order numbers 0,0,0 for the first one to 0,0,9 for the last control. Now, when I change Tab Index on the last one (0,0,9) to 5, each number from 0,0,5 to 0,0,8 increase by one and the control which Tab Index property I changed get number 0,0,5.

0
 
vb_jonasCommented:
I change the Tab index in the property editor.
0
 
anyoneisSoftware DeveloperAuthor Commented:
I have tried the same thing in both VB and C# (VS2005 on XP Pro) and I end up with two controls having the same TabIndex.

Can you give me a blow-by-blow account of what you are doing? Here is what I am trying:

1) Open the project and the selected form in design view:
2) Verify the tab order using "View, Tab Order" on a tab page that has 8 textboxes.
3) Leave tab order mode using "View, Tab Order".
4) Select the last textbox on the tab.
5) Change the tab index from 7 to 5 in the property editor
6) Select the form
7) Verify the tab order using "View, Tab Order"

the textboxes display:
0.0.0
0.0.1
0.0.2
0.0.3
0.0.4
0.0.5
0.0.6
0.0.5

Nothing was changed automatically.
0
 
vb_jonasCommented:
Ah, tried it out more in detail now - yikes, I doesnt work the way I thought. Old habits die hard. In VS6 this worked like I explained, and I have been doing a lot of VB6 lately. And, continuing the same behaviour it works (mostly) in VS2005 aswell, when running the app, but not because of the TabIndex, rather due to the z-order as you said. I am very sorry to have misled you, and if it was possible I should have my points decreased or something.

/ashamed and confused

0
 
anyoneisSoftware DeveloperAuthor Commented:
Drat! :-) I was hoping this one was of those "you use this key and I use that key" kinds of things. Apparently, we both learned some things!

I guess it's not that bad, once you realize that you have to select the particular tab page on the tab tabcontrol before you enter "View, Tab Order". It would be nice to have an "AutoNumberFromHere" function thsat would work similarly to how you described.

Ciao!
David
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.