ActiveX DLL Interfaces and referencing collections

 I am building an object that has some public collections; this object fills these collections with other objects that are created during code execution in the parent object.
  I am having a problem in defining the interface for this object.  I can define the methods and properties in the interface but cannot define the collections.  The collections are dimmed in the declarations portion of the object's class module and then Set in the intialize event; "set colItems = new collection".
  When I declare the same collection in the interface I receive an error, if I don't declare it then I can't see it.  What am I doing wrong?
  Any examples or references to this problem would be greatly appreciated.
Thanks.
danhotbAsked:
Who is Participating?
 
AnswerTheManConnect With a Mentor Commented:
<<I can't see it>>....
without getting into your concept - if all you want is to SEE it - add Module1 to your project and declare the Collection there.
0
 
danhotbAuthor Commented:
I think I'm asking the question badly.

Let me ask it this way:

INTERFACE: ITest

Option Explicit

public sub BuildPerson()

end sub


OBJECT: CPerson

Option Explicit
Implements ITest

private sub ITest_BuildPerson()
   'At this point I would add other
   'objects, like CShoe, to a collection
   'but don't know how to reference this
   'collection from the interface.

end sub


0
 
AnswerTheManCommented:
i can't follow your architecture. perhaps it's because i don't know what you are after.
however, it seems to me that ActiveX DLL is NOT the proper tool to use here.
AvtiveX EXE is a REAL object, since its Out Of process.

anyway, if all your objects are created in the same project - my answer should enable you to access the collection from any point.
else  - reject my answer.

you say you creadted some process that enable interaction between your objects.
using them - you can alaways pass a reference to the collection.
more then that - you can obtain a reference to the collection inside EACH of its members doing this :
add in an object class, a module level collection object variable :
*public MyParent as Collection*
now, when you create an object you add it to a collection named *MyCol*.
right after that write :
*Set Objectname.MyParent=MyCol*

now, you have a reference to the collection from within any object inside it.
0
All Courses

From novice to tech pro — start learning today.