Tab Control

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a tab control on a form. I have defined 11 tabs in the tab control
collection, using the designer. When I build and run the solution, the tabs
are not in the same order as viewed in the designer.

Also, when I save and load the project again, the tabs are displayed in a
different order in the designer. I can adjust the tabs and save the
solution and sometimes they are loaded back in the original order and
sometimes they are not.

It is really a strange problem.

Dan
 
Hello Dan,

Thanks for your post. Based on my research, this is a known issue that
TabPages get out of order after the scrollbar is not functional. One
workaround to rearrange the tabs back in correct order is to re-assign the
tabPages to the correct index before the form is loaded.

//-------------code snippet------------------
public Form1()
{
InitializeComponent();

tb.TabPages[0] = tabPage5;
tb.TabPages[1] = tabPage4;
tb.TabPages[2] = tabPage3;
tb.TabPages[3] = tabPage2;
tb.TabPages[4] = tabPage1;
......
}
//----------------end of------------------

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
I have a tab control on a form. I have defined 11 tabs in the tab control
collection, using the designer. When I build and run the solution, the tabs
are not in the same order as viewed in the designer.

Also, when I save and load the project again, the tabs are displayed in a
different order in the designer. I can adjust the tabs and save the
solution and sometimes they are loaded back in the original order and
sometimes they are not.

I've had the same trouble with trying to rearrange tabpages when they
get out of order. If you go into the InitializeComponent() method, and
find the place where the tabpages are added to the tab control (like
this.myTabControl.Controls.AddRange()), you might see them being added
out of order there, and you can fix the code.

Matthew
 
Back
Top