VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Custom Enumerator

by Kelly S. Ethridge (10 Submissions)
Category: VB function enhancement
Compatability: VB Script
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

Did you wish you could create enumerators to be used by For..Each in VB6?
Using lightweight objects, custom enumerators can be created, and all you have to do is implement the IEnumerator interface in your class.
This archive contains several example enumerators for both arrays and a class that is a dynamic list. I show several styles of enumeration (Forward, Reverse, Random) just so you can see that it doesn't have to always be in a straight line.
The real beauty is the lightweight object. I hand build a wrapper object about your IEnumerator interfaced object, and it delegates the IEnumVARIANT method calls to your custom enumerator.
You can create any kinds of enumerator, with as little or as much logic as you want. Have it enumerate a collection of collections, and have it appear to be enumerating a single collection!
Please leave feedback and/or vote :)

Rate Custom Enumerator

Upload

Download this snippet    Add to My Saved Code

Custom Enumerator Comments

No comments have been posted about Custom Enumerator. Why not be the first to post a comment about Custom Enumerator.

Post your comment

Subject:
Message:
0/1000 characters