I am confused about when a form is unloaded, if ever. I have forms loading
as MDI forms that have a withevents reference to a global class raising
events. When the forms close, the closed event fires, etc., but the raised
event continues to be captured in the forms. The form is opened from a sub
on the main form, like
Dim frm as frmMine
frm = new frmMine
frm.show
The frm is a local variable to the sub so goes out of scope with the sub.
Why would this continue to fire, and how can I get the form to unload. In
general, I have tested a few sample apps that have simply an MDI that opens
a form and when the form has some databound controls linked to a dataset,
when the form's close the memory use stays the same or even increases:
reopen the form and the memory increases, repeat over and over and the
memory grows. Calling gc.collect has no effect, but if I reduce the form to
hidden and re-open then the memory drops down to very little and when I
re-open the form it remains small. What gives?
Thanks for any help, I am fairly new to .Net.
Glenn 3 1166
Hi Glenn,
One way is to call Form.Close to reclaim memory and destroy the form. http://msdn.microsoft.com/library/de...CloseTopic.asp
HTH
rawCoder
"Glenn" <g.***@comcast.net> wrote in message
news:e3**************@tk2msftngp13.phx.gbl... I am confused about when a form is unloaded, if ever. I have forms loading as MDI forms that have a withevents reference to a global class raising events. When the forms close, the closed event fires, etc., but the
raised event continues to be captured in the forms. The form is opened from a
sub on the main form, like
Dim frm as frmMine
frm = new frmMine frm.show
The frm is a local variable to the sub so goes out of scope with the sub.
Why would this continue to fire, and how can I get the form to unload. In general, I have tested a few sample apps that have simply an MDI that
opens a form and when the form has some databound controls linked to a dataset, when the form's close the memory use stays the same or even increases: reopen the form and the memory increases, repeat over and over and the memory grows. Calling gc.collect has no effect, but if I reduce the form
to hidden and re-open then the memory drops down to very little and when I re-open the form it remains small. What gives?
Thanks for any help, I am fairly new to .Net.
Glenn
I no longer have a reference to the form elsewhere to call close: once the
procedure that opened the form ends, its reference that was used to open it
is gone.
The user is closing the form through the X box and the form's closed event
is firing: doesn't this mean the form is closed? However its form level
withevents variable is still receiving events fired elsewhere.
Thanks.
Glenn
"rawCoder" <ra******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hi Glenn,
One way is to call Form.Close to reclaim memory and destroy the form.
http://msdn.microsoft.com/library/de...CloseTopic.asp HTH rawCoder
"Glenn" <g.***@comcast.net> wrote in message news:e3**************@tk2msftngp13.phx.gbl... I am confused about when a form is unloaded, if ever. I have forms
loading as MDI forms that have a withevents reference to a global class raising events. When the forms close, the closed event fires, etc., but the raised event continues to be captured in the forms. The form is opened from a sub on the main form, like
Dim frm as frmMine
frm = new frmMine frm.show
The frm is a local variable to the sub so goes out of scope with the
sub. Why would this continue to fire, and how can I get the form to unload.
In general, I have tested a few sample apps that have simply an MDI that opens a form and when the form has some databound controls linked to a
dataset, when the form's close the memory use stays the same or even increases: reopen the form and the memory increases, repeat over and over and the memory grows. Calling gc.collect has no effect, but if I reduce the
form to hidden and re-open then the memory drops down to very little and when I re-open the form it remains small. What gives?
Thanks for any help, I am fairly new to .Net.
Glenn
"Glenn" <g.***@comcast.net> wrote in I am confused about when a form is unloaded, if ever.
You'll need to get familiar with the Garbage Collection model.
Why would this continue to fire, and how can I get the form to unload.
The form isn't unloaded, it is probably waiting for the next garbage
collection sweep. If you want it to release those WithEvents variables,
then you'll have to tell it to do that as it is closing down....
LFS This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Wayne Wengert |
last post by:
In VB6 I used to use frmForm1.Show to make a form visible to the user and
then use Unload frmForm1 to unload it. I have an app in which I need to
"load" and "unload" forms based on user actions....
|
by: LilleSkutt |
last post by:
I want to use assemblies (Window Forms as .dll) so that I can replace the form while the main application is running. To accomplish this, I used Assembly.LoadForm to manually load the assembly when I...
|
by: Rom Marshall |
last post by:
Hi.
Once a LOB size goes beyond 32KB in size, I'm not able to use the LOAD
utility to unload the data off the tables for DB2 7.1 on OS/390.
Instead, the documentation refers to a sample C++...
|
by: vineeth |
last post by:
Hi
I have GUI assembly which is loaded into a seprate Appdomain using AppDomain::Load method, after using it's function i unloaded the assembly by calling the AppDomain.UnLoad() method. But i can...
|
by: Guru Prasad |
last post by:
Is there a delay involved in unloading assemblies once a virtual directory
is "deleted" using IIS Manager ? At times even after the virtual directory
is removed i cannot delete the backing physical...
|
by: peter hansen |
last post by:
I tried a couple of weeks ago but I'll try again :D
I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire...
|
by: Eric A. Johnson |
last post by:
In a new project I'm creating, I have my first form that loads being used as
a splash screen, with a timer that activates after 5 seconds. I then want
the main form to load. However, it isn't...
|
by: ibenc |
last post by:
Is there a way to prevent w3wp.exe from unloading a particular
appDomain. Some parameters, config files?
Here is some info about why I need this.
I have a long running background thread in...
|
by: Geoff |
last post by:
VB6. When selecting from drop down menu options I display different forms by
using the Load (filename) and leave the form with Unload(Filename)
The Load event allows me to program the ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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,...
|
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...
|
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...
| |