Sheritlw
asked on
Insert a Hidden Tab in TabControl
I am using the code below to hide and show tabs.
It was working great until I had to add another tab to the end of the tab list.
So when I add the tab, it goes to the end of the list and I need it to inserted into the 2nd to last tab position.
I tried insert, but the controls on the tab no longer line up with the numbering system I use.
All controls on Tabs are the same name with the index of the tab appended.
i.e.
Tab 0 = controlname & 0
so the name would be controlname0
Tab 1 = controlname & 1
so the name would be controlname1
etc.
There are numerous controls/grids on each tab and each is named that way.
How do I position the tab that is being show in the position tabcontrol.selectedindex - 2
Thank you
It was working great until I had to add another tab to the end of the tab list.
So when I add the tab, it goes to the end of the list and I need it to inserted into the 2nd to last tab position.
I tried insert, but the controls on the tab no longer line up with the numbering system I use.
All controls on Tabs are the same name with the index of the tab appended.
i.e.
Tab 0 = controlname & 0
so the name would be controlname0
Tab 1 = controlname & 1
so the name would be controlname1
etc.
There are numerous controls/grids on each tab and each is named that way.
How do I position the tab that is being show in the position tabcontrol.selectedindex - 2
Thank you
Dim tabs As New System.Collection.Generic.Dictionary(Of String, TabPage)
Private Sub RemoveTab(name As String)
Dim tab As TabPage = TabRacing.TabPages(name)
tabs.Add(name, tab)
TabRacing.TabPages.Remove(tab)
End Sub
Private Sub RetrieveTab(name As String)
Dim tab As TabPage = tabs(name)
tabs.Remove(tab)
TabRacing.TabPages.Add(tab)
End Sub
Well the insert index would be tabControl.tabpages.count -2, this would get you the second to last index in the tabpage order.
ASKER
Yes, I am aware of that. Each tabpage has a set of numbered controls.
When they click to add a tab, they are asked which tab to add. This tab has already been created at design time and was just hidden. I need to show everything about the selected tab.
When they click to add a tab, they are asked which tab to add. This tab has already been created at design time and was just hidden. I need to show everything about the selected tab.
I read the question and that looked like what you were asking.
ASKER
Expert oobayly gave me my original solution. Is there anyone that may know how to insert a hidden tab before the last tab in a TabControl?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.