C# .NET - C# 3.0 - Hide / Show tabPage in a tabControl

Asked By Aldo Liaks on 14-May-08 01:27 AM

Hi guys, I am  just astonished...

I have  a tabControl with a couple of tabPages and need to hide / show them.

I googling and reading that the only way is Removing the tabPage and adding it again?

Is that means that I must remove and create all the controls every time?

I just can't believe it!


See this - Sagar P replied to Aldo Liaks on 14-May-08 01:54 AM

It's a common mistake to try to use the Visible property of the TabPage to make the tab invisible. But this does not work (The Visible property of the TabPage is essentially obsolete). The TabControl doesn't provide you an easy way to do so.

The workaround is to remove and add the TabPage from the TabControl whenever you want to hide/unhide it.

Like this;
Or you can use enabled prop also .....
Best Luck!!!!!!!!!!

RE - Sunil Lakshkar replied to Aldo Liaks on 14-May-08 01:55 AM

HI Aldo,

You can add or remove tabItems in tabControl but cannot hide/show it.

You cannot - Vasanthakumar D replied to Aldo Liaks on 14-May-08 02:22 AM


you cannot do this..

you need to remove and add tab pages dynamically..

check here for more details


Recreating objects - Aldo Liaks replied to Sagar P on 14-May-08 03:07 AM

Hi Sujit,

What happens with all the objects in the tabPage?

Do I have to recreate them too?

No Need yaar - Sagar P replied to Aldo Liaks on 14-May-08 03:18 AM

You dnt have to recreate them. You are removing them means you are not deleting them frm form u r just hidng them.

All the control will be there u just have to add n remove it like;



Best Luck!!!!!!!!!!!!!


That's good - Aldo Liaks replied to Sagar P on 14-May-08 03:17 AM
Remove all tabPages together - Aldo Liaks replied to Sagar P on 14-May-08 03:37 AM
Is there any change to remove all existing tabPages in one statement?
here it is... - Vasanthakumar D replied to Aldo Liaks on 14-May-08 05:05 AM


use this code..


Chirag Bhavsar replied to Aldo Liaks on 16-May-08 04:49 AM

The TabControl control is a container control that allows you to display multiple dialogs on a single form by switching between the tabs. This is analogous to using dividers in a notebook.

Each tab acts in a similar manner to a http://en.csharp-online.net/Panel control and is its own type of object called a http://en.csharp-online.net/TabPage. These tabs are located in the collection stored in the TabPages property of the TabControl.

Hiding Tab Pages

A TabPage does not have a Visible property that does anything meaningful. Therefore in order to hide/show a TabPage, the TabPage must be removed:


or added accordingly:

If you want to restrict the user from performing any operations on the tabpage you may try this:

TabPageSMS.Enabled = False

this will disable all the controls on the tabed page

having the same controls on the tab pages(C#) - Varsha Chandra replied to Aldo Liaks on 01-May-09 12:29 AM


i have a question on tab controls on windows form using C#. I need to create a tab control with 3 or more tab pages in it. Now i want each tab to have same controls only the content should change when i click on different tabs. For e.g. if i have a table with 5 columns on the first tab page then all the other pages should also have the same table just that data that is coming up should be different. I dont want 3 different table to be created for three different tab. Please send me the code if possible and let me know if you need any clarification.



arrays - Aldo Liaks replied to Varsha Chandra on 02-May-09 05:05 AM

Hi there,

I am not an expert, but I think you should work with arrays of tab pages.

I don't have a code example doint that... just do the same (with arrays) like you would do with a single tab page.


John Nowak replied to Aldo Liaks on 10-Aug-11 12:00 PM

It sounds like what you really want is to leave the table outside of the tab control entirely.  Then you can load the table with different data each time the tab control's SelectedIndex changes (the SelectedIndexChanged event of the tab control, not the individual tab pages).

The concept of control arrays as it was in VB6 exists no longer.