Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide TabPage from TabControl [duplicate]

People also ask

How to hide TabPage in TabControl?

To hide a tab: tabControl. TabPages. Remove(tabPage);

How do I disable TabPage?

You can simply use: tabPage. Enabled = false; This property is not shown, but it works without any problems.

How to make a tab Page invisible c#?

The Hide method of the TabPage will not hide the tab. To hide the tab, you must remove the TabPage control from the TabControl..::. TabPages collection.


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.


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);
}

I realize the question is old, and the accepted answer is old, but ...

At least in .NET 4.0 ...

To hide a tab:

tabControl.TabPages.Remove(tabPage);

To put it back:

tabControl.TabPages.Insert(index, tabPage);

TabPages works so much better than Controls for this.


Visiblity property has not been implemented on the Tabpages, and there is no Insert method also.

You need to manually insert and remove tab pages.

Here is a work around for the same.

http://www.dotnetspider.com/resources/18344-Hiding-Showing-Tabpages-Tabcontrol.aspx