Learn to Order Tabcontrol in C#

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.

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source

Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.

Explore NERV on GitHub →