Hide TabPage

  • Thread starter Thread starter Kejpa
  • Start date Start date
K

Kejpa

Hey there!
I have a tabcontrol on one of my forms. Some of the tab should not be
accessable (and thus invisible) until you give the correct password. But I
can't hide the tab...
tabSecrets1.Visible=false
tabSecrets1.Hide
will not work, the tab is visible :(

Any help is appreciated
Kejpa
 
Kejpa,

You can add and remove tappages from the tabcontrol using those methods.

With that you have than directly overcome the strange bug in the tabcontrol.

Cor
 
Hey Cor,
in my form_load event I set pgSecret1.Visible=false but it's still visible.
If I use pgSecret1.Hide it's also there.

I guess I'm too tired to see what's really simple, so.... Just a small
snippet, plz :)

Regards
Kejpa
 
Hey there, all of you.
Guess what?
It's not working, at all. The Visible property is there but has no function,
same thing with the Hide method.

In order to hide it you have to set it's parent to Nothing, it reappear when
you set the parent back to the original control, but not in the original
position.

Guess .NET v 1.0 really should have been .NET v 0.1 :(
Things working swell in VB6 should work with the new framework too, IMHO

/Kejpa
 
Hide and the Visible property of tab pages does NOT work. It has a bug.
In order to make a tab not appear in the tab control, you must REMOVE it
from the tab control using the Remove method.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Kepja,

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.TabControl1.Controls.Remove(Me.TabPage1)
Me.TabControl1.Controls.Remove(Me.TabPage2)
Me.TabControl1.Controls.Remove(Me.TabPage3)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Controls.Add(Me.TabPage2)
Me.TabControl1.Controls.Add(Me.TabPage3)
End Sub
///
Like this?

Cor
 
Try, Me.TabControl1.TabPages.Remove(pgSecret1)
TabPages.Visible or TabPages.Hide does not work.

KC
 
Chris Dunaway said:
Hide and the Visible property of tab pages does NOT work. It has a bug.
According to some MVP it's not a bug it's a feature!
The visible property really works!
You can set the visible property of one page to True and the visible
property of the current page to False and then you will see the other page
without changeing the tabheader! THAT's a feature longed for.... NOT!

The Visible property is inherited from Control and that's why it's there,
it's used internally for the TabControl to know which page to show. What I
can't understand is why they didn't set it to Private/Protected.

And I can't understand why the TabVisible(index) property of the VB6
TabbedDialog didn't make the .NET cut?!?

That's my 2c
Kejpa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top