How to hide TabPage from TabControl


Question

How to hide TabPage from TabControl in WinForms 2.0?

1
146
2/16/2009 8:15:36 AM

Accepted Answer

No, this doesn't exist. You have to remove the tab and re-add it when you want it. Or use a different (3rd-party) tab control.

130
2/16/2009 8:20:23 AM

Code Snippet for Hiding a TabPage

private void HideTab1_Click(object sender, EventArgs e)
{
    tabControl1.TabPages.Remove(tabPage1);
}

Code Snippet for Showing a TabPage

private void ShowTab1_Click(object sender, EventArgs e)
{
    tabControl1.TabPages.Add(tabPage1);
}

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon