• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

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

Hi

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  

Thanks
0
const71
Asked:
const71
1 Solution
 
Arthur_WoodCommented:
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.

AW

0
 
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.

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

http://vbaccelerator.com/home/VB/Utilities/ActiveX_Documenter/article.asp

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."

HTH-Jon
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now