By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,650 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,650 IT Pros & Developers. It's quick & easy.

Disposing Object in VB 6.0

P: n/a
Hi all,

I'm just wondering that is any way to dispose all objects when my app is
shut down? I mean I can use for.. next loop to unload all loaded form when I
shut down my app.

Thank you,

Egghead
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
As a general rule, you only need to close system resources that you opened.
These are timers, sockets, files, etc., although the VB 6 runtime does a
pretty good job of this for you. Any object that is left at application
shutdown will have it's terminate event fired and the object will be
reclaimed by the system. To see if your application is correctly shutdown,
check the task manager (Ctrl-Shift-Esc) processes tab to see if it
disappears.

During runtime, VB 6 has a reference counting Garbage Collectors. Objects
are destroyed when their reference count goes to zero, which can occur in
one of three ways. Reference counts are decremented when an object is set
to Nothing, when it goes out of scope, or when a parent object's reference
count goes to zero. Thus setting a collection of objects to nothing will
decrement the reference count for each of the objects in the collection if
there are no other references to the collection.

As part of the application cleanup, the VB 6 runtime zeros and the
references of any objects left in memory and the terminate events will fire
at that time.

Mike Ober.

"Egghead" <ro******@shaw.ca> wrote in message
news:aFn%d.744821$6l.191574@pd7tw2no...
Hi all,

I'm just wondering that is any way to dispose all objects when my app is
shut down? I mean I can use for.. next loop to unload all loaded form when I shut down my app.

Thank you,

Egghead


Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.