0

I want to make a all of the tabs on a tabcontrol disappear/not be visible once a button is pressed. I've been trying some things, but they haven't worked out.

If someone could help me figure out how to do this, that'd be great.

This is in a regular C# project (made with forms).

user3158491
  • 45
  • 1
  • 1
  • 5

2 Answers2

0

TabPage like every other control has property "Visible". Set it to "false". Property Visible on TabPage has attribute Browsable set to false.

Try:

tabControl.TabPages[0].Visible = false; 
tabControl.TabPages["tab_name"].Visible = false;
Tomasz Malik
  • 180
  • 8
0

In Winforms making tabpages invisible is not possible.

Here is the workaround:

You first store the tabpage(s) you want to dissapear in a List<TabPage> and then delete it from the Tab. If you want them to reappear you can insert them from the List. You will want to take care of the correct positions.

You can't really get rid of the tabs and still keep the TabPage as the user couldn't tab to it. You may want to cover the whole tabs area, though, but this doesn't seem like a good idea. Maybe you rethink or reexplain what you really want to achieve..

TaW
  • 53,122
  • 8
  • 69
  • 111