James,
never create circular references in ActiveX objects. For example:
private syb Button_Click()
set theEngine = nwe classEngine
.. do something else here
end sub
because theEngine is a local variable,
VB automatically sets it to nothing before exiting the method, but if you have a circular reference theEngine will be still there eating up memory. In worst cases, even your application will not die hitting the X--the main dialog will close, but the application is still there and you can see in in the task manager.
There are many way to avoid circular reference. In your case I see two easy solutions. First is to declare B withevents, let B sends an event when it changes the variable (passing the variable itself) and class A to catch the event . At the end the two variables in class A and B will be the same. This is coumbersome but it works. I prefer the intermediate class. Create a class C and put the shared variables in it. Declare class C in class A, and pass it to class B via a property:
set myClassB.VarC = myClassC
in this way both A and B uses the same variable because it is in the same class. This is how I design my components after I learned the problem the hard way.
Well, there are ways including creating a 'weak' reference of class A using CopyMemory... I highly discorage the use of it. It is always better to look for 'native'
VB solutions.
Marco