I know how to enable For Each for a collection object encapsulated in a collection class as follows:
[tt]
Public Property Get NewEnum() As IUnknown
Set NewEnum = col.[_NewEnum]
End Property
[/tt]
However, when I try to do the same for a dictionary object, I get an error message from the compiler, "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic." The dictionary object that I am referring to is available from the Microsoft Scripting Runtime library (scrrun.dll).
What I am really after is a collection class that will sort by the key values when using For Each regardless of the order the items are added. I am up for an alternative solution in addition to a solution to this specific problem with the dictionary object.
PS: Not using VB.NET yet, still on VB6.
Thanks.
[tt]
Public Property Get NewEnum() As IUnknown
Set NewEnum = col.[_NewEnum]
End Property
[/tt]
However, when I try to do the same for a dictionary object, I get an error message from the compiler, "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic." The dictionary object that I am referring to is available from the Microsoft Scripting Runtime library (scrrun.dll).
What I am really after is a collection class that will sort by the key values when using For Each regardless of the order the items are added. I am up for an alternative solution in addition to a solution to this specific problem with the dictionary object.
PS: Not using VB.NET yet, still on VB6.
Thanks.