views:

605

answers:

4

Is there a way to set the visibility of a single tab in a tabcontrol? I thought something simple like this should work, but does not seem to to anything.

tabControl1.TabPages[1].Visible = false;  
tabControl1.Refresh();

There will be a main tab that always shows but I want to have other tabs that I can "turn on\off". I don't want to remove the tabs since I may need to show then again.

fk

A: 

What's wrong with showing them again?

leppie
I do want to show them again, I just don't want to show them all the time (e.g. depending on item selected in Main tab I want to show only some tabs, and not others). If I remove them I would need to recreate them (or save them) to show them again.
the empirical programmer
+1  A: 

Times haven't changed since 2.0:

StackOverflow - How to hide TabPage from TabControl

Philip Wallace
A: 

It's obviously not part of the standard Windows Forms library, but the Infragistics UltraTabControl has (among other features) a Visible property for each tab page.

Adam Neal
A: 

You can remove the tabControl page this.tControl1.TabPages.Remove(this.tControl1.TabPages["tabPageName"]);

Alll