Greetings all

I've done some research and its apparently impossible to hide a tab on a tabcontrol, I need to save one to a tab page variable and recreate it. I know how to add a tab from a TabPage variable

TabControl.Controls.Add(tab1);

However I have no idea how to save the tab into the variable in the first place! I would presume it is something like this:

TabPage tab1 = TabControl.TabPages("CaseDetails");

It's not having any of that though, any ideas?

Regards

Dan

TabPage tab1 = myTabControl.TabPages["CaseDetails"];

In case any one reads this EVER, here's what I did, and it seems to work

//Global variable
Tabpage tab1, tab2, tab3;

private void Form1_Load(object sender, EventArgs e)
{
    tab1 = tabPage1;
    tab2 = tabPage2;
    tab3 = tabPage3;
}

//Button on page 1.
private void button1_Click(object sender, EventArgs e)
{
    tabControl1.TabPages.Clear();
    tabControl1.Controls.Add(tab2);
    tabControl1.Controls.Add(tab3);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.