How to fix the TabControl order in a C# application. Ordering is done by manually adding each tab each time the application is invoke

This bug is annoying. I am currently developing a windows mobile application and I am using the TabControl control. I dont have any problem with it adding TabPages etc.

The only problem I have is when I tried to debug the order of TabPages get shuffled. This is a problem because my action depends on the tab index.

I don't know what's causing this, but I thought re adding the TabPages on RunTime might work, and it really work for me. So here's the pseudocode.


tabControl.TabPages.Clear(); //first clear the tabcontrol
//then readd your tabs
tabControl.TabPages.Add(tabOne);
tabControl.TabPages.Add(tabTwo);
tabControl.TabPages.Add(tabThree);
tabControl.TabPages.Add(tabFour);


Remember this code should be add after the InitializeComponent method in the main constructor.
How to fix the TabControl order in a C# application. Ordering is done by manually adding each tab each time the application is invoke How to fix the TabControl order in a C# application. Ordering is done by manually adding each tab each time the application is invoke Reviewed by czetsuya on Tuesday, September 29, 2009 Rating: 5

No comments:

Powered by Blogger.