-
Hi..
I have this property :
Public Property Get NewEnum() As IUnknown
'this property allows you to enumerate
'this collection with the For...Each syntax
Set NewEnum = mCol.[_NewEnum]
End Property
I am trying to use it to go through my collection of objects. mCol is a collection of objects. I dont have a clue what IUnknown is. This property was automatically created by VB itself. Can anyone help me in using this property in a For.. Each syntax. HELP PLEASE!!!
Collection Class is called Products
Single Class is called Product
mCol has the following properties:
mCol(Index)
mCol.Item. -> then properties of the single class Product
mCol.Add
mCol.Remove
mCol.Count
Basically i want to Enumerate all the objects then use mCol(Index) to list them in...
Please Help me
-
Code:
For each n in mCol
'process item n
next n
where as n has to be a variant for regular datatype, except UDT's, and any object variable matching all objects in collection
-
You don't have to change anything to the code for it to work. You just have to go to the 'Tools' menu and select 'procedure attributes'.
Now select the NewEnum procedure and make sure you see the details. Now set the Procedure_ID to -4. This isn't a normal option so don't use the dropdownbox. Also click on the 'Hide this member checkbox'.
Now you enumerator is ready. You will have to retrieve Variants when using a for ech ..... next structure.
-
I would like to know if it's possible to change the IUnkown in a known object.
example
Code:
Public Property Get NewEnum As Form
Set NewEnum = mCol.[_NewEnum]
End Property
I hope that this way I do not have to pull the object with a Variant.