473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to hide tabpage of tab control in windows form 2.0

Can anyone write the code to hide tabpage of tab control in windows
form 2.0

Thanks,
Amit

Nov 15 '06 #1
5 13246
Do you want to be left with just the tabs or with everything but the tabs?

Ciaran O'Donnell

"Amit" wrote:
Can anyone write the code to hide tabpage of tab control in windows
form 2.0

Thanks,
Amit

Nov 15 '06 #2
Amit wrote:
Can anyone write the code to hide tabpage of tab control in windows
form 2.0
Although TabPage has a Hide method, it has no effect. The only way to
hide a tab page is the remove it from the TabControl. To make it
visible again, you must re-insert it.

Nov 15 '06 #3
Although TabPage has a Hide method, it has no effect. The only way to
hide a tab page is the remove it from the TabControl. To make it
visible again, you must re-insert it.
Just to add on to this...

this.tabControl1.TabPages.Remove(this.tabPage2);

will remove tabPage2 from tabControl1. Note that the tab page still
exists with everything you put in the page. It hasn't been release
from memory. Later in code, you code then have:

this.tabControl1.TabPages.Add(this.tabPage2);

and the page will reappear. This works just fine, the way you would
expect the Hide command to work. I don't know why MS didn't just make
the Hide method work in the first place.

Nov 16 '06 #4

Will wrote:
Although TabPage has a Hide method, it has no effect. The only way to
hide a tab page is the remove it from the TabControl. To make it
visible again, you must re-insert it.

Just to add on to this...

this.tabControl1.TabPages.Remove(this.tabPage2);

will remove tabPage2 from tabControl1. Note that the tab page still
exists with everything you put in the page. It hasn't been release
from memory. Later in code, you code then have:

this.tabControl1.TabPages.Add(this.tabPage2);

and the page will reappear. This works just fine, the way you would
expect the Hide command to work. I don't know why MS didn't just make
the Hide method work in the first place.
Just for the record, I believe that the Hide() and Show() methods (and
their cousin .Visible = true/false) does work... it's just that the
interpretation that MS chose isn't the one that most people expect.

I believe that .Show() on a TabPage brings it to the front. That is, it
makes it the current tab page and "shows" it.

The only response I have seen from inside MS on this one is that if you
want to show that a tab page isn't relevant in a given situation then
you should disable it or disable all of the controls on it.

IMHO the TabControl is the clunkiest of the WinForms controls and needs
some serious help. I'm disappointed that more work wasn't done on this
in .NET 2.0.

Nov 16 '06 #5
Will wrote:
>
this.tabControl1.TabPages.Add(this.tabPage2);

and the page will reappear. This works just fine, the way you would
Just a note on your note! :)

The .Add command will add the tabpage back at the end! If you wish to
preserve the order of the tabs, then you will have to keep track of
them somehow.

Chris

Nov 16 '06 #6

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

Similar topics

4
by: TMB333 | last post by:
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....
5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
9
by: Robb Gilmore | last post by:
Hello, This is probably an easy one, but I have not been able to figure it out so far. I have a tab control on a windows forms app. Depending on some business logic, I need to hide/show some...
2
by: MAF | last post by:
How do I hide a tabpage of a given tab control? //Disable other tabs until item is saved this.tabPage2.Hide(); //this doesn't work this.tabPage3.Hide(); this.tabPage4.Hide();
8
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
by: GatorBait | last post by:
Hi everyone, I have a tabcontrol on a form that contains 4 tabs. I want to make each tab a seperate form because there is a great deal of code behind each page, and organizationally it was...
1
by: Ingo Beyer | last post by:
Hello, I created a windows form with vs.net 2005 / c#. This control has a TabControl with 16 TabPages. On every TabPage there are a diffrent number of Controls. - Every TabPage has a background...
0
by: xyz | last post by:
Hi, I have two tab control on two different pages. On one tabControl I need the tab headers. When I remove the tabpage from this tabControl and put it on another one I don't want to show the...
6
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.