How to get entire list for an enumeration such as ADODB.ConnectModeEnum for example


I want to populate a combobox drop down list of all ADODB.ConnectModes. Is there a way to use a loop to walk through each enum or must this be entered manually. The IDE does it successfully with its intellisense mechanism. If you are unsure of the answer plz do not replyn to this question. Only definitive answers  

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ADODB.ConnectModes is a enumeration, which really means that the values are a set of INTEGERS, which have been given 'names' for ease of use.  That actual names of the ConnectModes are not accessible anywhere, from code.

the VALUES assigned to each of the modes constants are:

adModeRead                     = 1
adModeReadWrite             = 3
adModeRecursive              = 4194304
adModeShareDenyNone     = 16
adModeShareDenyRead     = 4
adModeShareDenyWrite     = 8
adModeShareExclusive       = 12
adModeUnknown               = 0
adModeWrite                    = 2

but it is not possible to get the names of those constants, themselves, and even if you had the names, what would you want to do with them?  It is the number associated with each 'name' that is what is important, not the name itself.


const71Author Commented:
As i have stated, I want to have a combobox that shows the enum 'name' and the ItemData as the integer value. (how does the VB IDE do this??)

When i start entering parameters into a function that takes an enum parameter, VB shows me the list. I want to know how VB does it so I can do something similar.

Have a look at this program, written in VB, that does this very thing:

The author notes, "If you're just interested in how to use TLBINF32.DLL, you will find all the code used to do it in the main form of the application."


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.