Results 1 to 2 of 2

Thread: Property Choices During Run Time

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Dunstable, Beds, UK
    Posts
    3

    Post

    How do I give the user a number of choices when they change a property on my ActiveX Control, like the little dropdown box you see when you change the allignment on a text box.


  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089

    Post Enumerators

    You Need to use an enumerator. say you want to want to let your user choose one of the 7 Dwarves (for some reason) place this code at the top uf your control

    Code:
    Public Enum enmDwarves
        
        Happy
        Grumpy
        Sneezy
        Bashfull
        Doc
        Dopey
        TheOtherOne
    
    End Enum

    then when yuo declare your property use

    Code:
    Public Property Let Dwarf as enmDwarves

    you can give the members of the enum values if you need to by putting = x after their names when you declare (x is a number, dont write x) them eg


    Code:
    Public Enum enmDwarves
        
        Happy = 1 
        Grumpy = 2
        Sneezy = 3
        Bashfull = 4
        Doc = 5
        Dopey = 6
        TheOtherOne = 7
    
    End Enum
    but you shouldn't need to, the names of the dwarves act just like constants, whatever values they take, so you can just write

    Code:
    If Dwarf = Happy Then
    and it'll work fine


    Hope this helps.

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