473,498 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding a TabPage???

(posted this in VB group but then realized I probably should have posted here)

I have a TabControl with several TabPages. Upon startup, I only want to
show the first TabPage, hiding the rest. Then once the user does some things,
I will show the other TabPages.

I have tried by putting TabPage2.Hide() in the Form_Load event, but no luck.
I put the same in a button to see if it was a timing issue with loading.
Still nothing.

What am I missing here??

Thanks!!
Nov 22 '05 #1
4 2490
In article <D9**********************************@microsoft.co m>,
St*********@discussions.microsoft.com says...
(posted this in VB group but then realized I probably should have posted here)

I have a TabControl with several TabPages. Upon startup, I only want to
show the first TabPage, hiding the rest. Then once the user does some things,
I will show the other TabPages.

I have tried by putting TabPage2.Hide() in the Form_Load event, but no luck.
I put the same in a button to see if it was a timing issue with loading.
Still nothing.

What am I missing here??


The current Tab control doesn't support hiding/unhiding of individual
tag pages. Instead, you'll need to remove/add the tab pages dynamically
at run time.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 22 '05 #2
Wow. That seems like something basic that would be there. I've been doing it
in Delphi for some years now. But that is neither here nor there.

I would assume that I would have to dynamically create all the controls on
the form too.

Could I have a tabcontrol with the hidden pages on it, with the entire
control hidden, and then just move them (change the parent, or something) to
the tabcontrol that is visible?

Any pointers would be much appreciated.
"Patrick Steele [MVP]" wrote:
In article <D9**********************************@microsoft.co m>,
St*********@discussions.microsoft.com says...
(posted this in VB group but then realized I probably should have posted here)

I have a TabControl with several TabPages. Upon startup, I only want to
show the first TabPage, hiding the rest. Then once the user does some things,
I will show the other TabPages.

I have tried by putting TabPage2.Hide() in the Form_Load event, but no luck.
I put the same in a button to see if it was a timing issue with loading.
Still nothing.

What am I missing here??


The current Tab control doesn't support hiding/unhiding of individual
tag pages. Instead, you'll need to remove/add the tab pages dynamically
at run time.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 22 '05 #3
Stress Puppy,

That is not so strange that you do it in Delphi already many years, when I
see an application with Tabpages I always start to assume that it is written
with Delphi, it seems always for me if there are no other applications made
with Delphi than with tabpages at the right and a treeview on the left side.

However the dotNet tabcontrol has a bug at the moment (What means for me
because almost everybody knows this one that there are not so many bugs).

To resolve that bug is the simple solution to make a simple loop wherein you
remove and add the pages when you need that from the tabcontrol. It is not
removing the pages or creating them new. It is only removing and setting the
reference in the tabcontrol so not a real performance consuming operation.

I hope that this gives an idea.

Cor
Nov 22 '05 #4
Hiding a control is the same as setting it's Visible property to false. When
a tabpage is not selected it is not visible. This is why the Hide/Visible
methods do not work as you expect.

I would just have the one tabcontrol, and when I have finished adding and
designing tabpages, I would remove the tabpages from the tabcontrol by
removing the "TabControl.Controls.Add(TabPageX)" lines in
InitializeComponent(). Then, at runtime, add tabpages to the tabcontrol as
they become available for user interaction.

Instead of editing the InitializeComponent() code, you may wish to clear the
tabpages and then add the first tabpage, in the forms load method. This way
all tabpages are always available for editing at designtime.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
397
by: StressPuppy | last post by:
(posted this in VB group but then realized I probably should have posted here) I have a TabControl with several TabPages. Upon startup, I only want to show the first TabPage, hiding the rest....
1
1674
by: Paul Sampson | last post by:
Hi, Does anyone know how to hide certain TabPages inside a TabControl in VS.NET 2003? I've seen code to remove the tabpage but I want to show/hide based on the user's access rights each time,...
1
3869
by: Dmitry Karneyev | last post by:
Hi! I've made a form with combobox and a tabcontrol. Each time the value of combobox changes I need to show only one tabpage from tabcontrol. It works, but the tabcontrol bookmark of selected...
1
7633
by: RA | last post by:
Hi 1) I want to create a TabPage class in design mode - how do I do it? What type of project should I use? Is it going to be a custom control? 2) I have a TabControl that I would like to add to...
8
12044
by: touf | last post by:
Hi, I've a tabcontrol that contains many similar tabpages (exactly the same structure with different information), the tabpages number isn't known in the design time it depends of the data. Is...
2
1473
by: RSH | last post by:
I am trying to upgrade an old VB 6 project to .Net. One of the things this application has is a series of 6 tabs in a tabcontrol...BUT the tabs themselves arent visible when you run the...
2
1672
by: Kevin | last post by:
Although lots of people described how to workaround the lack of ability to hide and show tab pages on a tab control, I couldnt find a code example so I made one. Create a class that inherits from...
5
3745
by: marfi95 | last post by:
I am having to resort to Mick's methods when it comes to hiding/showing tabpages of my tab control since .NET doesn't work correct. I think I have it finally workign the way I need, but because I...
6
4553
by: ray well | last post by:
i want a user to be able to change tab pages thru the keyboard, i tried entering the TabPage.text as '&1 Names', "&2 Addresses', etc., so that the user can change pages by type ALT 1, ALT 2, on the...
6
12857
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello gurus, I want to have a Form with a TabControl, this TabControl will contain TabPage that has controls in it, this TabPage is prepared at design time. I want in runtime to duplicate the...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4908
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.