Shawn,
Can you suggest some reading material on this subject. I too need help in this
area.
Thanks
Dave
----- Original Message -----
From: Shawn K. Hall
To: [email protected]
Sent: Tuesday, February 01, 2005 4:53 PM
Subject: RE: [vbhelp] Multiple Forms Etc.
Hi Chris,
> Ok, what's this I hear that "unload form" leaves
> the variable values in memory?
I like to call it "the facts of life." ;)
> I thought that totally unloaded the form and its
> values. I was under the impression you had to hide
> it if you wanted to keep the values intact. Or, is
> this only for locally declared variables in the form
> which are kept, in which case I understand.
It's a little more screwed up than that. Unloading a form is only
successful if there are no more references to objects on the form
(such as object assignments for value content instead of the .text
or .value *actual* content). You can accidentally keep a form loaded
and sucking up memory just by failing to use proper naming
conventions and variable assignment. This is good:
myVar = form1.mytextbox.text
This is bad:
myVar = form1.mytextbox
> Am I going to run into problems just hiding forms until
> the job is done then unload them all?
Yep. EVEN AFTER YOU USE UNLOAD!
The only thing unload does is attempt to reduce the object count
(references to each object on a form) gracefully by disconnecting
the unused references. If variables referencing these objects are
still in valid context, however, unload will often fail. Instead you
should always unload THEN set the object to nothing.
More importantly, though, you should practice safe coding practices
and ensure your code always uses ONLY the absolutely necessary
variable scope, explicit objtect types, strong and clean variable
assignements, and always use a sub main to start your program, not a
default form. Using sub main allows you to cleanly create objects
with limited scope or controlled events, where automatic form
initialization doesn't allow you to do this.
Regards,
Shawn K. Hall
http://12PointDesign.com/
http://ReliableAnswers.com/
'// ========================================================
Thinking is the hardest work there is, which is the
reason why so few engage in it.
-- Henry Ford
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [email protected]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
------------------------------------------------------------------------------
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
b.. To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [email protected]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/