473,775 Members | 2,305 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 2550
In article <D9************ *************** *******@microso ft.com>,
St*********@dis cussions.micros oft.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************ *************** *******@microso ft.com>,
St*********@dis cussions.micros oft.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.Con trols.Add(TabPa geX)" lines in
InitializeCompo nent(). Then, at runtime, add tabpages to the tabcontrol as
they become available for user interaction.

Instead of editing the InitializeCompo nent() 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. 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.
1
1688
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, rather than removing the tabpage. There doesn't seem to be an Enabled or Visible property and setting Locked = True doesn't seem to do anything either.
1
3886
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 tabpage is visible. I could be great if it's possible to hide it beacuse this element is useless in my case. Can anybody help me?
1
7652
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 it the TabPage created in step 1. I don't want to draw the TabPage on the Tabcontrol in design mode, but to have a few TabPage controls that I candynamicaly load to the TabControl at runtime. Thanks
8
12068
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 there a way to clone ( copy the structure) a tabpage to create anew one by code? thanks.
2
1494
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 application...instead the only way to go from one tab to the next is programatically. I have looked through all the properties I can find to set the tabs themselves to invisible. Please note: I'm not trying to hide the panel associated with the tab...just...
2
1697
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 the tabcontrol and then add the following Private htVisibleVal As New Hashtable Private htVisibleKey As New Hashtable Private htInvisibleKey As New Hashtable 'stores the current tabpages
5
3762
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 can show/hide up to 10 tabs, there is a lot of repainting/flickering going on and looks really bad with everything flashing all over the place. Is there a way to turn off the painting until all the tab stuff is executed and then do 1 refresh ? ...
6
4568
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 keyboard. but the text showing up in the tab is '&1 Names' instead of the '1' being underlined, and being able to be accessed thru the keyboard. how can i get a user to be able to change from TabPage to TabPage thru the keyboard? i find it...
6
12934
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 TabPage that wad made during the design time together with all its controls, but without the controls data. Is there an easy way to do that?
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9915
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7463
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.