Well, it depends on how you need them to talk. You can pass an object into a method ByRef (passing a pointer), and as long as you don't store it in a module level variable, you don't really have a circular reference issue.
Basically
VB is the same as working with COM in C++, with the exception that you control the reference counter in C++.
VB handles the reference counting for you. The good news is that every reference is counted, and you have fewer details to track. The bad news is that you can't miscount purposefully.
Be careful if you go with the circular references, because you have to manage the cleanup well. I would try to keep the object structure as a tree, with references to the parent only. This way you can walk up & down the tree as needed, but you have clearly defined parent-child relationships for the purpose of top-down cleanup.
In 95% of the code I have done, I didnât need circular references. In the other 5% I was always able to make a tree work (with a parent reference only). You can use the
block to make the code easier to read, and less typing. They also run faster if you are making multple calls to an object that is more than one jump.
Example: lets say you have the following relationship.
A->B->C->D (D is a child of C; C is a child of B; ...)
If you need D to look at the data in A, you could do the following:
Following code would be in D
Code:
With Me.Parent.Parent.Parent ' Me is D, first parent is C, etc.
.Property1 = 5 ' Property in A
.Property2 = 7 ' Property in A
.Method1 ' Method in A
' .etc
End With
John R Lick
[email protected]