When you use a Tab control in a .Net Windows form and then change the TabPage order using the items property, it does not always display properly. This is a known and documented bug which has not been fixed.
I ran into it recently and found a handful of solutions, the best of which seemed to be adding the TabPages into the Tab's controls array manually when the form loaded:
Code:
'Assumes a tab control named tc and 4 TabPages
tc.Controls(0) = tabPage0
tc.Controls(1) = tabPage1
tc.Controls(2) = tabPage2
tc.Controls(3) = tabPage3
I set the index value in the Tag property and then ensured the correct order by doing something like this:
Code:
Dim index As Integer
For Each tp As TabPage In Me.tc.TabPages
index = CInt(tp.Tag)
Me.tc.TabPages(index) = tp
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.