469,575 Members | 1,249 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Show/Hide multiple TabControls at runtime

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 functions I have 2 sub functions under each("Add Job", "View
Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
TabControl, so there are 2 TabControl objects on my main screen, each with 2
pages on.

When the user first enters the application, all they can see is the Menu
Tree View. When they click a child node in the treeview, it reveals to them
the TabControl for the parent node of the one they selected, and changes the
TabPage to the relevant child node sub function.

My question is this:

Should I just be using the TabControl.Hide() and TabControl.Show() methods
to achieve this functionality i.e When they select a "Add User" I call
tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
OR
Should I destroy the current TabControl object, and then rebuild the
requested TabControl object??

If so, how do I do this destroy and create process?

Thanks

Steve
Jul 21 '05 #1
5 4254
My suggestion to you is to use the "Visible" property to show or hide the tab
control. Setting Visible to "true" makes the tab control appear and setting
it to "false" makes the control disappear.

--
Jorge L. Matos

"Steve" wrote:
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 functions I have 2 sub functions under each("Add Job", "View
Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
TabControl, so there are 2 TabControl objects on my main screen, each with 2
pages on.

When the user first enters the application, all they can see is the Menu
Tree View. When they click a child node in the treeview, it reveals to them
the TabControl for the parent node of the one they selected, and changes the
TabPage to the relevant child node sub function.

My question is this:

Should I just be using the TabControl.Hide() and TabControl.Show() methods
to achieve this functionality i.e When they select a "Add User" I call
tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
OR
Should I destroy the current TabControl object, and then rebuild the
requested TabControl object??

If so, how do I do this destroy and create process?

Thanks

Steve

Jul 21 '05 #2
what is the beneift of visible over hide() and show(). My main concern with
doing it in this kind of way though was from a memory usage point, when you
hide or make an object not visible, does it stay in memory? Is this a point
worth worrying about?

"Jorge L Matos [MCSD.NET]" wrote:
My suggestion to you is to use the "Visible" property to show or hide the tab
control. Setting Visible to "true" makes the tab control appear and setting
it to "false" makes the control disappear.

--
Jorge L. Matos

"Steve" wrote:
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 functions I have 2 sub functions under each("Add Job", "View
Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
TabControl, so there are 2 TabControl objects on my main screen, each with 2
pages on.

When the user first enters the application, all they can see is the Menu
Tree View. When they click a child node in the treeview, it reveals to them
the TabControl for the parent node of the one they selected, and changes the
TabPage to the relevant child node sub function.

My question is this:

Should I just be using the TabControl.Hide() and TabControl.Show() methods
to achieve this functionality i.e When they select a "Add User" I call
tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
OR
Should I destroy the current TabControl object, and then rebuild the
requested TabControl object??

If so, how do I do this destroy and create process?

Thanks

Steve

Jul 21 '05 #3
there is no hide() or show() method on the microsoft tab control
--
Jorge L. Matos

"Steve" wrote:
what is the beneift of visible over hide() and show(). My main concern with
doing it in this kind of way though was from a memory usage point, when you
hide or make an object not visible, does it stay in memory? Is this a point
worth worrying about?

"Jorge L Matos [MCSD.NET]" wrote:
My suggestion to you is to use the "Visible" property to show or hide the tab
control. Setting Visible to "true" makes the tab control appear and setting
it to "false" makes the control disappear.

--
Jorge L. Matos

"Steve" wrote:
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 functions I have 2 sub functions under each("Add Job", "View
Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
TabControl, so there are 2 TabControl objects on my main screen, each with 2
pages on.

When the user first enters the application, all they can see is the Menu
Tree View. When they click a child node in the treeview, it reveals to them
the TabControl for the parent node of the one they selected, and changes the
TabPage to the relevant child node sub function.

My question is this:

Should I just be using the TabControl.Hide() and TabControl.Show() methods
to achieve this functionality i.e When they select a "Add User" I call
tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
OR
Should I destroy the current TabControl object, and then rebuild the
requested TabControl object??

If so, how do I do this destroy and create process?

Thanks

Steve

Jul 21 '05 #4
there is on mine. Visual Studio .Net 2003, I've used it.

"Jorge L Matos [MCSD.NET]" wrote:
there is no hide() or show() method on the microsoft tab control
--
Jorge L. Matos

"Steve" wrote:
what is the beneift of visible over hide() and show(). My main concern with
doing it in this kind of way though was from a memory usage point, when you
hide or make an object not visible, does it stay in memory? Is this a point
worth worrying about?

"Jorge L Matos [MCSD.NET]" wrote:
My suggestion to you is to use the "Visible" property to show or hide the tab
control. Setting Visible to "true" makes the tab control appear and setting
it to "false" makes the control disappear.

--
Jorge L. Matos

"Steve" wrote:

> 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 functions I have 2 sub functions under each("Add Job", "View
> Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
> TabControl, so there are 2 TabControl objects on my main screen, each with 2
> pages on.
>
> When the user first enters the application, all they can see is the Menu
> Tree View. When they click a child node in the treeview, it reveals to them
> the TabControl for the parent node of the one they selected, and changes the
> TabPage to the relevant child node sub function.
>
> My question is this:
>
> Should I just be using the TabControl.Hide() and TabControl.Show() methods
> to achieve this functionality i.e When they select a "Add User" I call
> tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
> OR
> Should I destroy the current TabControl object, and then rebuild the
> requested TabControl object??
>
> If so, how do I do this destroy and create process?
>
> Thanks
>
> Steve

Jul 21 '05 #5
You're right, the Show() and Hide() methods are inherited from the Control
base class. I never use those methods since they are equivalent to setting
the Visible property to true or false respectively and I've always used the
Visible property. To answer your question the control remains in memory when
you use the Hide() or Show() methods ( or set the Visibile property to true
or false ). I do not recommend destroying and re-creating objects when you
do not need to do so.

--
Jorge L. Matos

"Steve" wrote:
there is on mine. Visual Studio .Net 2003, I've used it.

"Jorge L Matos [MCSD.NET]" wrote:
there is no hide() or show() method on the microsoft tab control
--
Jorge L. Matos

"Steve" wrote:
what is the beneift of visible over hide() and show(). My main concern with
doing it in this kind of way though was from a memory usage point, when you
hide or make an object not visible, does it stay in memory? Is this a point
worth worrying about?

"Jorge L Matos [MCSD.NET]" wrote:

> My suggestion to you is to use the "Visible" property to show or hide the tab
> control. Setting Visible to "true" makes the tab control appear and setting
> it to "false" makes the control disappear.
>
> --
> Jorge L. Matos
>
>
>
> "Steve" wrote:
>
> > 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 functions I have 2 sub functions under each("Add Job", "View
> > Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a
> > TabControl, so there are 2 TabControl objects on my main screen, each with 2
> > pages on.
> >
> > When the user first enters the application, all they can see is the Menu
> > Tree View. When they click a child node in the treeview, it reveals to them
> > the TabControl for the parent node of the one they selected, and changes the
> > TabPage to the relevant child node sub function.
> >
> > My question is this:
> >
> > Should I just be using the TabControl.Hide() and TabControl.Show() methods
> > to achieve this functionality i.e When they select a "Add User" I call
> > tcUsers.Show() then tcJobs.Hide(), and vice versa if they picked "Add Job"
> > OR
> > Should I destroy the current TabControl object, and then rebuild the
> > requested TabControl object??
> >
> > If so, how do I do this destroy and create process?
> >
> > Thanks
> >
> > Steve

Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by MAF | last post: by
12 posts views Thread by Jerad Rose | last post: by
4 posts views Thread by bridgemanusa | last post: by
reply views Thread by question | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.