ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting Class Collections & their Contents to Nothing. (https://www.excelbanter.com/excel-programming/390056-setting-class-collections-their-contents-nothing.html)

chatterbox

Setting Class Collections & their Contents to Nothing.
 
Hi Everybody

I would like to check something out that I'm a little wooly on. I
have a project, and when finishing, the code sets the collection
objects and their contents to Nothing. My query is this; if there are
two class collections, A and B, and a number of objects {C} which can
belong to A, B, or A and B, is there a proper order for setting to
Nothing A, B, and {C} ? The reason for my wooly headedness is that I
am not entirely certain what constitutes a Parent-Child cross-
referenced association, and therefore what to do in that case. I'm
half certain this isn't such a case, but I don't really know.

If you can offer me some advice, ideally by way of an exmple, I would
appreciate it.

Regards

chatterbox


Tom Ogilvy

Setting Class Collections & their Contents to Nothing.
 
A and B hold references to C. Even when set to nothing, the variable
continues to exist. Setting A or B to nothing does nothing to the things
referenced in its collection. Setting C to nothing does nothing to the
references held within the A and B collections. There is no parent-child
relationship as I understand your description.

--
Regards,
Tom Ogilvy


"chatterbox" wrote:

Hi Everybody

I would like to check something out that I'm a little wooly on. I
have a project, and when finishing, the code sets the collection
objects and their contents to Nothing. My query is this; if there are
two class collections, A and B, and a number of objects {C} which can
belong to A, B, or A and B, is there a proper order for setting to
Nothing A, B, and {C} ? The reason for my wooly headedness is that I
am not entirely certain what constitutes a Parent-Child cross-
referenced association, and therefore what to do in that case. I'm
half certain this isn't such a case, but I don't really know.

If you can offer me some advice, ideally by way of an exmple, I would
appreciate it.

Regards

chatterbox



chatterbox

Setting Class Collections & their Contents to Nothing.
 
With the uncertainty of any parent-child associations put to rest, I
can close out all of the class objects in the usual way.

Thanks Tom




All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com