Link to home
Start Free TrialLog in
Avatar of anyoneis
anyoneisFlag for United States of America

asked on

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
Avatar of vb_jonas
vb_jonas
Flag of Sweden image

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.
Avatar of anyoneis

ASKER

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.


The controls on each tab page (container) has their own tab order.
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
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.

I change the Tab index in the property editor.
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.
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

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
ASKER CERTIFIED SOLUTION
Avatar of vb_jonas
vb_jonas
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial