473,385 Members | 1,312 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,385 software developers and data experts.

Remove not hide User Control, posting again

March 24, 2006

Hi all

I am new to VB.NET and am using VB.NET 2005.

I have an MDI form with a Split Container Control. On demand I am adding and
removing User Controls on Panel 2. I am using Show() and Hide(). It works
perfectly. The only thing is I would like to remove the User Control from
memory instead of hiding. I tried Dispose(), however then I cannot show this
user control again.

UserControl.Parent=Form.SplitContainer1.Panel2
UserControl.Dock=DockStyle.Fill
UserControl.Show()
..
..
UserControl.Hide()

Thanks.
Mar 24 '06 #1
5 3968
"Mike TI" <su*******@hotmail.com> schrieb
March 24, 2006

Hi all

I am new to VB.NET and am using VB.NET 2005.

I have an MDI form with a Split Container Control. On demand I am
adding and removing User Controls on Panel 2. I am using Show() and
Hide(). It works perfectly. The only thing is I would like to remove
the User Control from memory instead of hiding. I tried Dispose(),
however then I cannot show this user control again.
This is a contradiction: Remove from memory .... show again.

If you removed something from memory, you can not show it again because it
does not exist anymore.
UserControl.Parent=Form.SplitContainer1.Panel2
UserControl.Dock=DockStyle.Fill
UserControl.Show()
.
.
UserControl.Hide()

Thanks.

Armin

Mar 24 '06 #2
I mean is it possible for me to show the user control again and again on
demand with the same behaviour as it was displayed for first time (firing
load event etc.) instead of using Hide() which probably is the same thing as
Visible=False.

Thank you.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
"Mike TI" <su*******@hotmail.com> schrieb
March 24, 2006

Hi all

I am new to VB.NET and am using VB.NET 2005.

I have an MDI form with a Split Container Control. On demand I am
adding and removing User Controls on Panel 2. I am using Show() and
Hide(). It works perfectly. The only thing is I would like to remove
the User Control from memory instead of hiding. I tried Dispose(),
however then I cannot show this user control again.


This is a contradiction: Remove from memory .... show again.

If you removed something from memory, you can not show it again because it
does not exist anymore.
UserControl.Parent=Form.SplitContainer1.Panel2
UserControl.Dock=DockStyle.Fill
UserControl.Show()
.
.
UserControl.Hide()

Thanks.

Armin

Mar 24 '06 #3
Mike,

Of course you only have to instance it from its class and add it to your
form again.

Dim myControl as New myUsercontrol.
me.controls.add(myControl)

And set than the right properties again.

I hope this helps,

Cor

"Mike TI" <su*******@hotmail.com> schreef in bericht
news:%2****************@TK2MSFTNGP09.phx.gbl...
I mean is it possible for me to show the user control again and again on
demand with the same behaviour as it was displayed for first time (firing
load event etc.) instead of using Hide() which probably is the same thing
as Visible=False.

Thank you.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
"Mike TI" <su*******@hotmail.com> schrieb
March 24, 2006

Hi all

I am new to VB.NET and am using VB.NET 2005.

I have an MDI form with a Split Container Control. On demand I am
adding and removing User Controls on Panel 2. I am using Show() and
Hide(). It works perfectly. The only thing is I would like to remove
the User Control from memory instead of hiding. I tried Dispose(),
however then I cannot show this user control again.


This is a contradiction: Remove from memory .... show again.

If you removed something from memory, you can not show it again because
it does not exist anymore.
UserControl.Parent=Form.SplitContainer1.Panel2
UserControl.Dock=DockStyle.Fill
UserControl.Show()
.
.
UserControl.Hide()

Thanks.

Armin


Mar 24 '06 #4
Of course you can. That's the whole rationale behind instantiating objects.

Just create an new instance of the component, set all the relevant
properties as required and hook up the event handlers as required and Bob's
your uncle.
"Mike TI" <su*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I mean is it possible for me to show the user control again and again on
demand with the same behaviour as it was displayed for first time (firing
load event etc.) instead of using Hide() which probably is the same thing
as Visible=False.

Thank you.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
"Mike TI" <su*******@hotmail.com> schrieb
March 24, 2006

Hi all

I am new to VB.NET and am using VB.NET 2005.

I have an MDI form with a Split Container Control. On demand I am
adding and removing User Controls on Panel 2. I am using Show() and
Hide(). It works perfectly. The only thing is I would like to remove
the User Control from memory instead of hiding. I tried Dispose(),
however then I cannot show this user control again.


This is a contradiction: Remove from memory .... show again.

If you removed something from memory, you can not show it again because
it does not exist anymore.
UserControl.Parent=Form.SplitContainer1.Panel2
UserControl.Dock=DockStyle.Fill
UserControl.Show()
.
.
UserControl.Hide()

Thanks.

Armin


Mar 24 '06 #5
"Mike TI" <su*******@hotmail.com> schrieb
I mean is it possible for me to show the user control again and
again on demand with the same behaviour as it was displayed for
first time (firing load event etc.) instead of using Hide() which
probably is the same thing as Visible=False.


If you do not want to use Hide, you have to remove it from the container
control, call Dispose and remove remaining references. Whenever you need a
control again, you can create it, set it's properites and add it to the
container (TheContainer.Controls.Add). If you have a variable declared using
"WithEvents" that was previously pointing to the former control, you can
assign the new control to this variable again and all event procedures will
be working just like with the former control. If you don't have a WithEvents
variable, use the AddHandler statement to attach event handlers to the new
control.
Armin

Mar 24 '06 #6

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

Similar topics

19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
10
by: Ray Z | last post by:
hi, there I build a Class Library, I write a class A to implement interface IA. The problem is when I give the dll file to others, thet can get all information about not only IA, but also A. They...
4
by: moondaddy | last post by:
I have a datagrid where a user can edit a number in one of the columns for a quantity value. On the postback I loop through all of the datagrid items and if the quantity has changed, then I update...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
5
by: dbuchanan | last post by:
Is it possible to detect the SQLS2K column level permission for the logged in user. I want to be able to hide a control or Button based on user permission to edit that column. Can anyone...
4
by: Blaine | last post by:
Does anyone know how I can hide a form from the TaskManager? I've set the ShowInTaskbar to False, but when using Alt-TAB to switch between applications, it appears as a blank icon. I can set it...
10
by: sara | last post by:
Hi - Is it possible to hide the detail section of a report at run time? I have a report that prints all details, with summary lines. The user would like the report ALSO with just summary lines....
6
by: Doogie | last post by:
Hi I have an img control I am trying to hide upon certain types of commands in my code behind. When to hide it is directly tied to a asp:dropdownlist control. So depending on what the user...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.