Brett Barabash
BBarabash at TappeConstruction.com
Fri Apr 18 10:15:25 CDT 2003
Thanks Bryan, 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. 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.mindspring .net&oe=UTF-8&output=gplain -----Original Message----- From: Bryan Carbonnell [mailto:carbonnb at sympatico.ca] Sent: Friday, April 18, 2003 9:56 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB6: Object Reference It sounds like you will need a "Tear Down" method of your class. In your calss add: Public Sub TearDown () Set mfrmMyForm.SourceObject = Nothing Set mfrmMyForm = Nothing End Sub Then when you want to destroy the class you need to call your TearDown method before you set it to nothing 'Close and destroy YourClassVariable.TearDown Set YourClassVariable = Nothing It's the same approach you have to take when you build Parent Properties for Classes. -- Bryan Carbonnell - carbonnb at sympatico.ca Age is a very high price to pay for maturity. _______________________________________________ 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.