How do I programmatically reorder the tabs in a TabControl
? I need to sort the tabs depending on some conditions.
If it's possible to do the reordering through the designer, i guess we must be able to do it through code at runtime too.
this.TabControl1.TabPages.Remove(this.TabPage2)
this.TabControl1.TabPages.Insert(0, this.TabPage2)
Note that if you fail to remove the tab page, it will still show at its old location. In other words, you will have two tabs of the same tab page.