473,651 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Par ent=Form.SplitC ontainer1.Panel 2
UserControl.Doc k=DockStyle.Fil l
UserControl.Sho w()
..
..
UserControl.Hid e()

Thanks.
Mar 24 '06 #1
5 3978
"Mike TI" <su*******@hotm ail.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.Par ent=Form.SplitC ontainer1.Panel 2
UserControl.Doc k=DockStyle.Fil l
UserControl.Sho w()
.
.
UserControl.Hid e()

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*******@free net.de> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
"Mike TI" <su*******@hotm ail.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.Par ent=Form.SplitC ontainer1.Panel 2
UserControl.Doc k=DockStyle.Fil l
UserControl.Sho w()
.
.
UserControl.Hid e()

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*******@hotm ail.com> schreef in bericht
news:%2******** ********@TK2MSF TNGP09.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*******@free net.de> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
"Mike TI" <su*******@hotm ail.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.Par ent=Form.SplitC ontainer1.Panel 2
UserControl.Doc k=DockStyle.Fil l
UserControl.Sho w()
.
.
UserControl.Hid e()

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*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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*******@free net.de> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
"Mike TI" <su*******@hotm ail.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.Par ent=Form.SplitC ontainer1.Panel 2
UserControl.Doc k=DockStyle.Fil l
UserControl.Sho w()
.
.
UserControl.Hid e()

Thanks.

Armin


Mar 24 '06 #5
"Mike TI" <su*******@hotm ail.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.C ontrols.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
6871
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 JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
10
3269
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 can even see my protected members of class A. How could I hide these informations about class A, just give them the interface informations. thanks.
4
4565
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 the value of the extended price cell for that datagrid item. Also, the datagrid has a checkbox in each row called "Remove" where if the checkbox is checked I delete that row from the underlying datasource and set a flag which tells me to...
9
20158
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 control. When I close the form I am expecting that the control ceases to be. However, if my object raises the event after the form has been closed, I find that there is still a user control object that handles it. Clearly the user control has not...
5
1509
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 direct me to example code for this? Thank you, Doug
4
4385
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 as a SizableToolWindow, but then I no longer have the minimize button on the caption. Is there a way to mimic a (FormBorder) sizable tool window (so it doesn't appear in the tasklist) and still show the Min, Max and Close control buttons? (Or...
10
11748
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. It seems the simplest thing is to run the code (see below) once with the detail section showing, and a second time hiding the detail section. I can't figure out the code to do that and don't see it posted.
6
3210
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 selects in that dropdownlist, this image will be hidden or be displayed. I have tied the onselectedindexchanged value of the dropdownlist to a c-sharp method (not javascript) because other things are being done as well that I want to do server side. ...
3
5258
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 add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
8352
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
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
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...
1
8465
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
8579
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...
0
7297
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
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
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.