473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Disposing Object in VB 6.0

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
1 5983
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Chris Capel | last post by:
I've heard a lot of talk on the forum about memory managment in .NET and disposing things, finalizing them, garbage collection, etc. My question is which managed types need to be disposed after...
4
by: MC D | last post by:
Question: If I have a class which has a property which is a collection of widget objects (an arrayList of widgets), and both the containter class and the widget class implement the IDisposable...
13
by: MuZZy | last post by:
Hi, Just wanted to make sure i get it right: consider this class: // =========== START CODE ============= class Test { private SqlConnection con = null; public void Connect() { con = new...
4
by: sunitabalakrishna | last post by:
Hi, Could someone explain me if I need to implement the Dispose pattern on managed objects that hold objects which have longer life or is a singleton? Example - Class A holds Class Global...
5
by: Chris | last post by:
I have a form that requires drawing custom lines on it. The color of the lines is suppose to be the same as the forcolor of the form. Am I doing this the most efficent and correct way? ...
10
by: sternr | last post by:
Hey, I have a C# assembly that inherits from ServicedComponent and is installed in the Com+ with ServerActivation. And I have a C++ application that calls this Com+ object successfully, But the...
0
by: Gman | last post by:
Hi, Objective: Draw a grid on a bitmap and set this as a panel's image. (Rather than draw the grid directly on the panel and redraw repeatedly in the paint event.) Problem: It works fine....
4
by: Rob | last post by:
Hi all, I wrote myself a little function to do my own housekeeping, I can call it by using Dispose(object) Within this function there's a select case statement which will then, based on...
8
by: Varangian | last post by:
Hello, was wondering of how to dispose of managed resources? or referencing every member of a class to null will release resources...? http://www.marcclifton.com/tabid/79/Default.aspx...
29
by: Jerry Spence1 | last post by:
I'm rather confused as to whether something should be disposed of, or not. What is the general rule? How can you be sure of doing the right thing? I've heard about disposing unmanaged resources but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
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,...
0
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,...
0
jinu1996
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...
0
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...
0
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,...

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.