Windows Forms Topics include: windows forms, controls, components and designers

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > .NET > Windows Forms > Hoe to Hide a TabPage in a TabControl (C#)

Thread Tools Display Modes
Old 03-08-2003, 03:53 AM
Faisal Faisal is offline

Preferred language:
Join Date: Mar 2003
Location: Pakistan
Posts: 1
Faisal is on a distinguished road
Default Hoe to Hide a TabPage in a TabControl

I have five tabpages on my tabcontrol and want to hide and show one of them on a button click
Reply With Quote
Old 03-08-2003, 12:21 PM
divil's Avatar
divil divil is offline
Join Date: Nov 2002
Location: England
Posts: 2,746
divil is on a distinguished road

You can't just hide and show tabs in a tabcontrol - it was never meant to operate that way. Nor can you disable individual tabs. The best you can do is to remove them all and add the ones you need, or to not show some in the first place.
Reply With Quote
Old 04-03-2003, 11:56 AM
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Contributor

Preferred language:
Join Date: Jan 2003
Posts: 1,031
aewarnick is on a distinguished road

You cannot Hide() the tab but you can Hide() the tab page itself. I did that with some of my tab pages if the password the user entered was incorrect.
Reply With Quote
Old 04-03-2003, 02:58 PM
Nerseus's Avatar
Nerseus Nerseus is offline

Preferred language:
Join Date: Oct 2002
Location: Arizona, USA
Posts: 2,547
Nerseus is on a distinguished road

Neither Hide() nor setting Visible=False will work with TabPages. You can remove them through the TabControl's Controls collection or the TabPages collection using the Remove method.

For example, use one of the two lines below (they do the same thing):
// OR

Keep in mind that if you want to add the tabpages back in later, you have to add them in the order you want them. That may mean removing them all and adding them back in one at a time.

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Reply With Quote
Old 04-07-2003, 04:28 AM
Ariez Ariez is offline

Preferred language:
Join Date: Feb 2003
Posts: 164
Ariez is on a distinguished road

Make a procedure like:
exposeContrls(Page as control)
to expose the controls dynamically with page.controls.add...etc..
then you can remove and add any tabpage and load its interface.
Auto-suggestion: "I have a life"
Uncontroled thinking: "So what the.."
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide tabpage kejpa Windows Forms 7 10-22-2004 06:51 AM
TabPage Problem Mr60s Windows Forms 1 03-10-2004 05:11 AM
Scrollbar access of a tabPage Steve Windows Forms 0 03-04-2004 11:12 AM
TabPage order change hog Windows Forms 2 03-18-2003 02:03 PM
TabPage w/in a TabPage mscott Windows Forms 2 02-06-2003 10:45 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..