That's far too obscure.
All you need to do is store a reference to the TabPage instance which was removed from the TabPages collection of the TabControl. You may use the form where the TabControl is placed for that purpose.
You could also create your own TabControl which has an extra property for "
hidden
" TabPages and functions for showing/hiding pages, e.g. something like:
public class MyTabControl:TabControl
{
public MyTabControl():base()
{
_HiddenPages = new List<tabpage>();
}
private List<tabpage> _HiddenPages;
public List<tabpage> HiddenPages
{ }
public void HidePage(string name)
{
TabPage aPage = findShownPageByName(name);
this.TabPages.Remove(aPage);
_HiddenPages.Add(aPage);
}
public void ShowPage(string name)
{
TabPage aPage = findHiddenPageByName(name);
this.TabPages.Add(aPage);
_HiddenPages.Remove(aPage);
}
}</tabpage></tabpage></tabpage>