469,963 Members | 2,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Hide Method for TabPage object

I've researched as much as I can on the issue, but I've not found any clearly
defined statement that acknowledges that the Hide method for a TabPage object
just doesn't do what it's supposed to do. This appears to be a bug, or maybe
I'm using it incorrectly?

TabPage.Hide should hide the referenced TabPage object, should it not? Do I
have to 'refresh' the Windows form somehow?

The closest I've come to any means of hiding a TabPage from the TabControl
is to have a secondary TabControl that is hidden, and change the TabPage
object's Parent property to be the hidden TabControl. Then to make it
'reappear' in the original TabControl by reassigning the Parent property. The
only problem being here is that when the TabPage is reassigned to the
original, I have to write code to ensure that it 'reappears' in its
appropriate Index location. This just seems too silly to do, for a method
that is supposed to do this in the first place!
Jul 21 '05 #1
4 13296
Hide should have been removed from the options.
When a TabPage is not selected it is hidden (not visible).
What you want to do is remove and replace the TabPage. You don't need a
second TabControl to store it as the TabPage is not disposed when you remove
it from the TabControls TabPage Collection.

You will find Hide/Show/Insert/Swap TabPage methods on my site, along with a
few other tips.
http://dotnetrix.co.uk/tabcontrols.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"TMB333" <TM****@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
I've researched as much as I can on the issue, but I've not found any
clearly
defined statement that acknowledges that the Hide method for a TabPage
object
just doesn't do what it's supposed to do. This appears to be a bug, or
maybe
I'm using it incorrectly?

TabPage.Hide should hide the referenced TabPage object, should it not? Do
I
have to 'refresh' the Windows form somehow?

The closest I've come to any means of hiding a TabPage from the TabControl
is to have a secondary TabControl that is hidden, and change the TabPage
object's Parent property to be the hidden TabControl. Then to make it
'reappear' in the original TabControl by reassigning the Parent property.
The
only problem being here is that when the TabPage is reassigned to the
original, I have to write code to ensure that it 'reappears' in its
appropriate Index location. This just seems too silly to do, for a method
that is supposed to do this in the first place!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.775 / Virus Database: 522 - Release Date: 08/10/2004
Jul 21 '05 #2
Hi Mike,

Thanks for the reply. Nice site by the way!

However, under the section "Hide and Show Tabpages in a Tabcontrol" from the
link you gave me, I can understand how to use the HideTabPage routine since I
can reference the TabPage on my TabControl by its Index to use as an argument
for the routine, however, I am unsure what to pass as an argument to the
ShowTabPage routine as my TabControl no longer has the 'hidden' TabPage to
reference by either its Index number or its Name?

I'm sorry if this might seem trivial to you, but as I've been programming in
VB6 for quite some time, I'm relatively new to VB.NET.

Thanks.
Jul 21 '05 #3
Ahh, I found the answer to my own question. I was unaware until now that I
can reference a TabPage object from the Form object itself.
Jul 21 '05 #4
You Instantiate the TabPage on the Form and then add it to the TabControls
TabPageCollection.

\\\
Sub InitializeComponent()
...
Me.TabPage1 = New System.Windows.Forms.TabPage
...
Me.TabControl1.TabPages.Add(Me.TabPage1)
...
End Sub
///

So the TabPage is actually a Child of the Form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"TMB333" <TM****@discussions.microsoft.com> wrote in message
news:B2**********************************@microsof t.com...
Ahh, I found the answer to my own question. I was unaware until now that I
can reference a TabPage object from the Form object itself.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.775 / Virus Database: 522 - Release Date: 08/10/2004
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Peter | last post: by
2 posts views Thread by MAF | last post: by
8 posts views Thread by Kejpa | last post: by
4 posts views Thread by TMB333 | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.