J
james ou
as the title
thanks
thanks
System.Windows.Forms.Control[] {-----Original Message-----
The order of the tabs is determined by the order in which they were added to
the TabControl.Controls collection. So, if you just want to tweak the
display order initially, then you can just reaarange this order in the
designer generated code. But the change would probably have to be redone at
some point if teh designer regenerates teh code from scratch again for some
reason. So, you could avoid this regneration problem by clearing teh
Controls collection and adding them again in teh proper order in Form.Load.
this.tabControl1.Controls.Clear();
this.tabControl1.Controls.AddRange(new
this.tabPage4,
this.tabPage2,
this.tabPage3,
this.tabPage1});
At runtime, you can swap tab order with code like:
private void SwapTabs(int tab1, int tab2)
{
TabPage tab = this.tabControl1.TabPages[tab1];
this.tabControl1.TabPages[tab1] = this.tabControl1.TabPages[tab2];
this.tabControl1.TabPages[tab2] = tab;
if(this.tabControl1.SelectedIndex == tab1)
this.tabControl1.SelectedIndex = tab2;
else if(this.tabControl1.SelectedIndex == tab2)
this.tabControl1.SelectedIndex = tab1;
}
=================
Clay Burch, .NET MVP
Visit www.syncfusion.com for the coolest tools
as the title
thanks
.