For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > September 2004 > Custom Enumerator in VB6?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Custom Enumerator in VB6?
Gerald Hernandez

2004-09-28, 3:55 pm

Is it possible to create a custom enumerator object in VB6?
I am building a quite complex container object that in general behaves like
a very intelligent collection. I would "like" to be able to use For-Each
outside of the object to enumerate internal items. However, the enumeration
logic for this particular container is much more complex than a normal
collection. So I would like to create a custom enumerator to handle the
movenext, etc. methods like you can in other language implementations.
Something like:

Public Property Get NewEnum() as IUnknown
...
Set NewEnum = MyCustomEnumerator
End Property

Thanks,
Gerald


alpine

2004-09-28, 3:55 pm

On Tue, 28 Sep 2004 09:53:56 -0600, "Gerald Hernandez"
<Cablewizard@spam_remove@Yahoo.com> wrote:

>Is it possible to create a custom enumerator object in VB6?
>I am building a quite complex container object that in general behaves like
>a very intelligent collection. I would "like" to be able to use For-Each
>outside of the object to enumerate internal items. However, the enumeration
>logic for this particular container is much more complex than a normal
>collection. So I would like to create a custom enumerator to handle the
>movenext, etc. methods like you can in other language implementations.
>Something like:
>
>Public Property Get NewEnum() as IUnknown
> ...
> Set NewEnum = MyCustomEnumerator
>End Property
>
>Thanks,
>Gerald



Have a look at the CSuperCollection example in the Collections section
at http://www.mvps.org/vbvision/

HTH,
Bryan
________________________________________
____________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
Gerald Hernandez

2004-09-28, 3:55 pm

Perfect! Exactly what I was looking for.

Thank you,
Gerald

"alpine" <alpine_don'tsendspam@mvps.org> wrote in message
news:7v3jl0hctmbbv4en29h76lkg9or6kvjq2g@
4ax.com...
> On Tue, 28 Sep 2004 09:53:56 -0600, "Gerald Hernandez"
> <Cablewizard@spam_remove@Yahoo.com> wrote:
>
like[color=darkred]
enumeration[color=darkred]
>
>
> Have a look at the CSuperCollection example in the Collections section
> at http://www.mvps.org/vbvision/
>
> HTH,
> Bryan
> ________________________________________
____________________
> New Vision Software "When the going gets weird,"
> Bryan Stafford "the weird turn pro."
> alpine_don'tsendspam@mvps.org Hunter S. Thompson -
> Microsoft MVP-Visual Basic Fear and Loathing in LasVegas



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com