TabControl page order

  • Thread starter Thread starter Bob Trabucco
  • Start date Start date
B

Bob Trabucco

Hello all,

I am fighting a very aggravating problem in my VB.NET compact framework app.

I have a tab control on a form. I set up the pages and put them in the
order I like. It all works great.

Then for some reason at random times Visual Studio decides to scramble the
order! For the life of me I can't figure out a pattern. It is driving me
bonkers! It all works fine - the tabs are just in a random order. I have
no code anywhere that should change the order. I even tried going into the
InitializeComponent routine and setting the order there but Visual Studio
just comes along and wipes it out.

Any suggestions??? Is there something I can put in a Page Load so I can set
the order then??

Thanks in advance,

Bob
 
I had this same problem in early versions. My workaround was to reset the
order *after* InitializeComponent. I think this was fixed in one of the
SPs.
 
Chris,

Thanks for the response...

I tried setting it like this...

TabControl1.Controls.SetChildIndex(tab1, 0)
TabControl1.Controls.SetChildIndex(tab2, 1)

etc...
No success.

I do seem to have all available updates to the framework and Visual Studio
2003. Any others I should know about??

Thanks!
Bob
 
Here's a snip from one of my old projects...

<snip>
InitializeComponent();

// reorder the tabs since it's a CF bug
formTabs.Controls.SetChildIndex(this.mapTab, 1);
formTabs.Controls.SetChildIndex(this.findTab, 1);
formTabs.Controls.SetChildIndex(this.dataTab, 1);
formTabs.Controls.SetChildIndex(this.cacheTab, 1);
</snip>
 
Thanks for the code Chris but that didn't seem to help.

This doesn't look like a Compact Framework bug. I'd bet on a Visual Studio
IDE bug. When I look at the generated code I can see that Visual Studio is
changing the order around in the code as well. I suppose we could call it a
bug in the SetChildIndex function that is not switching the tabs around to
the order we specify - but screwing the tabs up in the first place I can
probably blame the IDE...

I have all the latest updates so I am at a impasse. The only thing I can do
that works is to close down designer view for the form, open up the code
view. Find the place where the code adds the tabs. Put it in the correct
order. Then do my build. This works until I open design view again...

Thanks again - and if anyone else has a suggestion I'd love to hear it...

Bob
 
I agree that it's a designer bug, but reordering outside of the designer
code (like my snippet) works in run time. Of course you have to chase the
tabs around in design-time, but at run time they're always in the correct
order.
 
Back
Top