|
-
March 25th, 1999, 10:13 AM
#2
Re: Form Load and UnLoad - MEMORY RELEASE
Hi
VB actually keeps forms around in memory - even if you explicitly 'unload' them - this is due to any static variables or routines you may have.
If you want to remove them from memory completely, use the following syntax :
Unload frmWhatever
Set frmWhatever = Nothing ' this releases the memory Code Segment
Also, if you are referencing multiple instances of forms in your code, make sure that you **Never** do a 'Dim frmMine As New frmWhatever' - this will load the form (or check if it's loaded) on each reference to the variable, also, once you've unloaded the form - it will load again on the next property access -
eg.
Dim frmMine As New frmWhatever
frmMine.Show
Unload frmMine
Set frmMine = Nothing ' Won't set it to nothing
frmMin.Show ' will reload it again
Regards
Chris Eastwood
CodeGuru - the website for developers
http://www.codeguru.com/vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|