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

Posted on 2006-04-26
Last Modified: 2012-05-05

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  

Question by:const71
    LVL 44

    Expert Comment

    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.



    Author Comment

    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.

    LVL 13

    Accepted Solution

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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction This article makes the case for using two modules in your VBA/VB6 applications to provide both case-sensitive and case-insensitive text comparison operations.  Recently, I solved an EE question using the LIKE function.  In order for th…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now