Dinesh Upreti

I have a requirement to simulate reordring of tabs(along with controls in it) just as a user would do in excel sheet (user can reorder the sheets in a excel workbook while working on it using the tab kind of interface provided at the bottom of workbook). I tried to do it using tab control, but couldnot figure out how any pointers on this or any other control which would make it possible.



Re: Windows Forms General Reordering tab control


All you need to do is to find the right event for you (in your case I suppose you should aim at something in DragDrop) and add something along the lines of the following:

TabPage TPTemp = this.TabControl1.TabPages[0];
this.TabControl1.TabPages[0] = this.TabControl1.TabPages[1];
this.TabControl1.TabPages[1] = TPTemp;

Hope this helped...

Re: Windows Forms General Reordering tab control

Mick Doherty

There's an example on codeproject:

I have a variation of this on my site:
http://www.dotnetrix.co.uk/tabcontrols.html --> Reposition TabItems at Runtime.

TabControlEx supports it with a property change (2 actually, AllowDrop + AllowTabDrag):

Re: Windows Forms General Reordering tab control

Dinesh Upreti


This is of great help.