[dba-VB] VB6: Object Reference

Brett Barabash BBarabash at TappeConstruction.com
Fri Apr 18 11:12:19 CDT 2003


Upon further investigation, I found that the recursive reference problem is
fairly common among VB developers.  In fact, VB.NET has a WeakReference
feature built-in to avoid this.

Here was another article that gave some interesting information:
http://www.programmersheaven.com/articles/harry/article1.htm


-----Original Message-----
From: Bryan Carbonnell [mailto:carbonnb at sympatico.ca]
Sent: Friday, April 18, 2003 10:49 AM
To: dba-vb at databaseadvisors.com
Subject: RE: [dba-VB] VB6: Object Reference


On 18 Apr 2003 at 10:15, Brett Barabash wrote:

> My only issue with your method, is that it requires the parent code to
> explicitly call the TearDown method to destroy the object.  If the
> TearDown method isn't called (crashes, sloppy code, whatever), the
> object will remain in memory.

Yep, same issue I have with doing it that way as well. Unfortunately, 
it's about the only way I can think of to do it.

IIRC, I got this methid from the VBADH by Getz & Gilbert.

> I ran across a very interesting article through Google groups, about
> establishing "Weak References".  Using the CopyMemory API call, you
> can establish an uncounted reference to an object and avoid the common
> circular reference problems.  A little bit more work and more risky
> (as an uncounted interface, you need to handle cleanup manually). 
> Still, an interesting read:
> http://groups.google.com/groups?selm=7uluuc%24srp%241%40nntp1.atl.mind
> spring .net&oe=UTF-8&output=gplain

Sounds like an interesting read. I must add it to my ever growing 
collection of things to read.

--
Bryan Carbonnell - carbonnb at sympatico.ca
We've all heard that a million monkeys banging on a million 
typewriters will eventually reproduce the entire works of 
Shakespeare.
Now, thanks to the Internet, we know this is not true.^ [Robert 
Wilensky (1997)]


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com


--------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Tappe Construction Co.

Scanning of this message and addition of this footer is performed
by SurfControl E-mail Filter software in conjunction with 
virus detection software.



More information about the dba-VB mailing list