Results 1 to 5 of 5

Thread: Custom Property Type?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Custom Property Type?

    Not sure what this is called, but I saw it once, and need to do it again.

    It's like a Boolean, you have a select list of options to choose from (in booleans case, it's only True or False) How do I create my own?

    Like:
    Dim k as CustomStatus
    k = Stopped

    Where CustomStatus can be set to one of the following only:
    Stopped
    Running
    Waiting
    Paused

    Even if I knew what this is called I can research it, but I never used it before.

  2. #2

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Custom Property Type?

    Enumeration is what you're looking for. The Keyword in VB is "Enum"
    Code:
    Public Enum myType As Integer
       ItemOne = 1
      ItemTwo
    ItemThree
    If you don't specify a value, the next number in the sequence will be used. If you don't specify a starting value, 0 gets used...
    Code:
    Public Enum myType As Integer
       ItemOne
      ItemTwo
    ItemThree
    Also the numbers don't need to be in order, but then you have to specify each value
    Code:
    Public Enum myType As Integer
       ItemOne = 10
      ItemTwo = 5
    ItemThree = 200
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Custom Property Type?

    You are thinking of an Enum:
    Code:
    Public Enum CustomStatus
     Stopped
     Running
     Waiting
     Paused
    End Enum
    My usual boring signature: Nothing

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Custom Property Type?

    Wow, two posts got in ahead of me.
    My usual boring signature: Nothing

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