Hide tabpage

kejpa

Junior Contributor
Joined
Oct 10, 2003
Messages
320
Hi,
I'm probably too worked out to see what's wrong. I can't hide one of the tabs of my tabcontrol.
tabSecret1.Visible=false
tabSecret1.Hide
don't change a thing, the secret tab is still there :(

Help me, plz!
/Kejpa
 
Rick_Fla said:
From things I have read, you have the visable property, but it does not work.
That's wonderful....
Sometimes I get the notion that the first release of .NET actually was a beta with the bugs commented out.
There are just sooo many things that isn't working that used to work in VB6.

Setting the parent to Nothing hides the tabpage, setting it back to the original control makes it reappear, but not in it's normal position. Guess we have to live with this.

/Kejpa
 
TabPages only have a Visible property because they inherit from Control. The TabControl uses it internally so that only the selected tab is visible, the rest are hidden. If the Visible property was changed to indicate tab visibility, how would it show/hide the different pages depending on which tab was selected?
 
divil said:
TabPages only have a Visible property because they inherit from Control.
Alright, they inherit from Control and that's why it's there, but MS could have chosen to have it declared Protected or Private then it wouldn't have been visible, no?

divil said:
The TabControl uses it internally so that only the selected tab is visible, the rest are hidden. If the Visible property was changed to indicate tab visibility, how would it show/hide the different pages depending on which tab was selected?
I got curious about this and it's true. This way you can change which page is visible without changing the header. <ironi>Now THAT's a feature we've longed for...</ironi> Maybe I'm too quick to judge but when do you need/want this?!?!?


The old VB6 tabcontrol had a property (TabVisible(index)) you could use to show/hide tabs. Why didn't it make the .NET cut?
I for one use it frequently to show/hide tabs depending on the user priviledges.

/Kejpa
 
kejpa said:
Alright, they inherit from Control and that's why it's there, but MS could have chosen to have it declared Protected or Private then it wouldn't have been visible, no?

No. You cannot hide an already public member in a derived class.

The TabControl wasn't based on the VB6 one, it was based on the Win32 one. It's a useful suggestion but the effort required to implement it probably outweighs its usefulness, especially since you can just remove and add tabs easily. Taking care of their relative positions requires very little code.

You can submit suggestions for future versions at http://lab.msdn.microsoft.com/productfeedback/default.aspx
 
The old VB6 TabStrip sucked, can't understand why they used it as base for a new TabControl. The old TabbedDialog had everything the TabStrip had + a number of useful features.

IMHO

I guess I will submit some suggestions at the page you pointed me to.

Thanx for your effort
/Kejpa
 
Back
Top