473,804 Members | 3,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tabpage add/remove

I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should
use Remove/Add. But I have some other controls in the tabpage which I don't
want to use code to dynamiclly create them. If I use remove to remove that
tabpage and later use add to add it back in, I have to write code to create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.
Nov 17 '05 #1
3 3485
On Wed, 25 May 2005 15:31:02 -0700, Cynthia wrote:
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should
use Remove/Add. But I have some other controls in the tabpage which I don't
want to use code to dynamiclly create them. If I use remove to remove that
tabpage and later use add to add it back in, I have to write code to create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.


Instead completly removing the TabPages use some kind of a TabPageManager.
This TabPageManager is a class having a collection of all your TabPages.
When you have to show a TabPage you get it from the TabPageManager and add
it to the TabControl. So if you remove a TabPage from the TabControl it
still exists in the TabPageManager. So the next time you have to show the
removed TabPage you get it again from the TabPageManager and add it to the
TabControl.

hth
--
Claudio Grazioli
http://www.grazioli.ch
http://www.grazioli.ch/HommingbergerGepardenforelle/
Nov 17 '05 #2
That should not happen unless you are trying to add a tabpage that is
already on the tabcontrol or are trying to add a copy of it.

See the methods on my site:
http://dotnetrix.co.uk/tabcontrols.html --> Hide and Show Tabpages in a
Tabcontrol.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Cynthia" <Cy*****@discus sions.microsoft .com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I
should
use Remove/Add. But I have some other controls in the tabpage which I
don't
want to use code to dynamiclly create them. If I use remove to remove
that
tabpage and later use add to add it back in, I have to write code to
create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.

Nov 17 '05 #3
Hi,

What if you keep a reference to the TabPage in an instance variable?
You could add/Remove it at needed.

Now a drawback of this is that you can only add it at the end of the
collection, there is no a InsertAt() method :(

Another posibility is to intercept the TabIndexChanged event and if revert
the selected tabpage.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Cynthia" <Cy*****@discus sions.microsoft .com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I
should
use Remove/Add. But I have some other controls in the tabpage which I
don't
want to use code to dynamiclly create them. If I use remove to remove
that
tabpage and later use add to add it back in, I have to write code to
create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.

Nov 17 '05 #4

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

Similar topics

4
13579
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. 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...
9
883
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 of the individual tabs. The tab page has no "visible" property. The tabpage class has a "hide" method, but this does not seem to make it disappear. I have been able to remove them via something like this:
2
3112
by: David N | last post by:
Just curious... Is there a way to remove the header for a tabpage? Thanks.
2
1734
by: Sumit | last post by:
Hi All, I am working on an application in which i have 4 tabpages say A, B, C & D. Now in one scenario i want that user is able to click on tabs A & B but the tabs C & D remain disabled for him. (i.e. he cannot click on them & the respective tabpages are not displayed). I dont know how to make the tabs of a tabcontrol disabled.
6
14487
by: Stan Sainte-Rose | last post by:
Hi, I've a Tabcontrol and I 'd like to disable a tabpage I try to use the hide and visible property but it doesn't work. Thx Stan
8
2313
by: Andre Nogueira | last post by:
Hi there. I would like to know it is possible in VB.Net 2003 to see that a user has clicked a tab page. My goal is to close the tab page if the user clicks a tabpage "separator" (not sure how to call it.. but it's that part that when you click on it the whole tab page becomes visible) holding the Shift key it closes. I can already see if the Shift key is being pressed using the Windows API, but I don't have a clue about where should I...
4
10164
by: Ratan | last post by:
I have a form that has a tabcontrol with 5 tabpages. i want to rename the tabpages in runtime. Actually i want to right click the tabpage i want to rename and edit the text there itself. How to acheive it? Any help will be greatlty appreciated. /Ratan
5
13304
by: Amit | last post by:
Can anyone write the code to hide tabpage of tab control in windows form 2.0 Thanks, Amit
6
12935
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
9706
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...
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
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
9143
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5520
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
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
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.