Results 1 to 5 of 5

Thread: List Constants, ActiveX Control

  1. #1

    Thread Starter
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    Unhappy List Constants, ActiveX Control

    Hi All,


    I'm developing an ActiveX Control, which behaves differrently when various arguments are passed to it. I've created a property to that control for this purpose and exposed it. I am able to access the property from the client and the controls works well when the value is set.

    Now, I want to know how I can provide a list of constants to be given to the property. That is, like in any other control say ListView control we have a View property. This property can be set to only the predefined constant values which popup immediately after the =, in VB IDE. I would like to know how to achieve this in my control.
    Cute Member

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Create a

    Public Enum Mytypes ' or whatever you want to call it

    for the constants, and then in you Property Get statment
    use

    Property Get Myvariable () as MyTypes

  3. #3

    Thread Starter
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185
    Originally posted by jim mcnamara
    Create a

    Public Enum Mytypes ' or whatever you want to call it

    for the constants, and then in you Property Get statment
    use

    Property Get Myvariable () as MyTypes

    Thanx Jim I'll Try that
    Cute Member

  4. #4

    Thread Starter
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    Angry

    Jim,

    I've tried creating the Enum values and modified the property get to
    Code:
    Property Get pName as myEnum
    But I wan to know how to modify the property let. since the type of argument for let has also to be enum type. How am i going to assign values to the property. since i cant use it as myEnum.something.

    Pls. Help me on this
    Cute Member

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Enum basically makes the enums as constants so you can use them to assign to the property or just an integer that is the same as a value.

    VB Code:
    1. Public Enum Stuff
    2.   WhatStuff
    3.   MyStuff
    4.   BadStuff
    5. End Enum
    6.  
    7. Private m_Mine as Stuff
    8.  
    9. Public Property Let Mine(ByVal Value as Stuff)
    10.   m_Mine=Stuff
    11. End Property
    12.  
    13. Public Property Get Mine() as Stuff
    14.   Mine=m_Mine
    15. End Property
    16.  
    17.  
    18. 'use
    19. obj.Mine=MyStuff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width