TabPage Sequence Problem

  • Thread starter Thread starter Sumit
  • Start date Start date
S

Sumit

Hi all,

I am working on an application in which there is a form which has a
tabcontrol containing 4 tab pages.
Let the name of the tabpages be A,B,C&D.

The default view is that there are all the tabpages(A-D) in the
tabControl.
Now there is a button on TabPage A & when the button is clicked the
default view changes to a tabcontrol having three tabpages A,B & D.
Also again if i click on the same button the TabControl should show all
the 4 tabPages.

So wat i have done is that when their are 4 tabPages & the button is
clicked i have done
TabControl.TabPages.Remove(C);

If their are three tabpages & the button is clicked i have done
TabControl.TabPages.Add(C);

But the problem that i am facing is that the sequence of tabpages is
not proper. It is adding the TabPage C at end( A-B-D-C) but i require
it in between B & D.(A-B-C-D).

Kindly tell me how can i change the sequence of TabPages being
displayed at runtime ??

Warm Regards
Sumit
 
Sumit,

A known bug, you have to remove D as well and than add C and D again.

(You only remove the references to the tabcontrol not the tabpages of course
and add those again)

I hope this helps,

Cor
 
Mick,

In this case the OP says that he has removed first tabpage C because of his
purpose.
I think that it will not make much difference than and maybe look even more
smooth in this case.

Cor
 
I'll agree, that in this case, it won't make much difference since there is
only one tabpage to remove before adding one and replacing it, but I would
still recommend swapping over removing and re-adding.
 
Back
Top