Reputation: 1566
I have a TabControl in Winforms that I can Remove a tabpage with a button via the code :
TabControl1.Tabpages.Remove(TabPage1)
however, when I add the tabpage again using this code
TabControl1.Tabpages.Add(TabPage1)
the tabpage gets added in after the last tabpage.
How do I restore the ORIGINAl location of the tabpage in the tabControl?
Upvotes: 0
Views: 541
Reputation: 38905
First, you'll have to store the original index so that you know where to put it back to:
index = TabControl1.TabPages.IndexOf(TabPage2)
...
...
TabControl1.TabPages.Insert(index , TabPage2)
Upvotes: 1