TabPage out of order

G

Guest

I have a TabControl in my app, with 11 tabs. Several times, the tabs get
magically reordered for me. Sometimes, it shows up in the designer as a new
order, so I simply open the collection and put the tab pages back into the
order I want. Why does that happen? Then, as another issue, they don't
match my order when I run the application. They look one way in the
designer, and a different way when it runs. How does that happen?

I have not edited the "Windows Form Designer generated code" portion of the
code myself, so I don't know how it was altered. At times, I can play with
the control, maybe add a tab then kill it, or move things around, save it
all, then it will work. Lately, that trick does not work, so the tabs are
out of order.

Ideas?
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Kenny ODell said:
I have a TabControl in my app, with 11 tabs. Several times, the tabs get
magically reordered for me. Sometimes, it shows up in the designer as a
new
order, so I simply open the collection and put the tab pages back into the
order I want. Why does that happen?

I have seen this happening in VS 2003 , no idea way though. It seems that is
a bug with the designer
Then, as another issue, they don't
match my order when I run the application. They look one way in the
designer, and a different way when it runs. How does that happen?

This I have never seen, but maybe it's the same than the above, just that
you never change back to design view, in any way it's an apparent bug in the
designer.
 
B

Bruce Wood

Kenny said:
I have a TabControl in my app, with 11 tabs. Several times, the tabs get
magically reordered for me. Sometimes, it shows up in the designer as a new
order, so I simply open the collection and put the tab pages back into the
order I want. Why does that happen? Then, as another issue, they don't
match my order when I run the application. They look one way in the
designer, and a different way when it runs. How does that happen?

I have not edited the "Windows Form Designer generated code" portion of the
code myself, so I don't know how it was altered. At times, I can play with
the control, maybe add a tab then kill it, or move things around, save it
all, then it will work. Lately, that trick does not work, so the tabs are
out of order.

This is a known bug in VS2003. I can't find anything on MSDN at the
moment... maybe another poster can locate the bug report.

I add code in my constructor (after the call to InitializeComponents())
to remove all tab pages from the TabControl and add them back in the
correct order. I've heard that there are ways to fiddle in the Designer
to always leave the TabPages in the correct state so that they'll be
serialized correctly into code, but they sound too delicate to me: I
prefer brute force.
 

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