Show List of Possible Selections for Class Object RRS feed

  • Question

  • I would like to know how I can get the list of possible choices to Intellisense for my class object, like it does with MsgBox.  For example, when creating a message box you type MsgBox "Test Message Text", vbYesNo, "Test Message Title"

    In typing that, when you type the comma just before the vbYesNo, it gives you the possible selections for button types in a drop down list: i.e., vbYesNo, vbOKOnly, etc...


    I have a class called clsKeyState.  what it does is turn on/off/toggle key states, such as CAPS LOCK, SCROLL LOCK, NUM LOCK, etc... I have set my property for it as Get/Let "State".  When I call it to set a key to on/off I will be doing it like this:

    KeyState.State WhichKey, On/Off/Toggle.

    I would like the WhichKey part to automatically display all the possible selections that I define, such as CapsLock, NumLock, Scroll Lock; and I want the On/Off/Toggle to display those specific items also (On, Off, Toggle).


    Please help, I will be using the ability to create these displayable options for many more things in my project than just this one simple class.

    David Wisniewski
    Friday, November 18, 2011 5:14 PM


  • the option for the message box (i.e. vbYesNo, vbOKOnly, etc...) are enum.

    you can create your own enum and specify that as a parameter in your class.

    Public Enum MyCustomEnum
        Level1 = 0
        Level2 = 1
        Level3 = 2
        Level4 = 3
    End Enum
    Public Class ClassTestingEnumAsParam
        Public Sub New(ByVal customEnum As MyCustomEnum)
        End Sub
    End Class
    Public Class DavidLeeWisniewski
        Public Sub New()
            Dim testClassEnum As ClassTestingEnumAsParam = New ClassTestingEnumAsParam(MyCustomEnum.Level1)
        End Sub
    End Class

    screen shot when implemented:


    • Marked as answer by Mr. Wharty Monday, February 13, 2012 5:02 AM
    Friday, November 18, 2011 10:32 PM