Results 1 to 5 of 5

Thread: Enum in VB4?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Posts
    42

    Question

    I'm trying to follow a coding example in VB5 and the words

    private enum ...end enum

    are used in the declarations section of a module. Is there a VB4 equivelency?


    Old Man
    Using VB6 Professional Ediion

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I have Peter Nortons Guide To Visual Basic 4
    and there is no mention of Enum....I think the
    book is very good so if it's not there, chance are
    it isn't to be found!
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Unfortuantely, VB4 doesn't support Enums.

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    You Can Do Pretty Much The Same thing tho, where you get a statement
    Code:
    Public Enum MyEnum
        MyEnum1 = 1
        MyEnum2 = 2
        MyEnum3 = 3
    End Enum

    just Change it to

    Code:
    Public Const MyEnum1 = 1
    Public Const MyEnum2 = 2
    Public Const MyEnum3 = 3

    and whereever it declares a variable As MyEnum declare it as Long instead. You won't get the picklists but all the Code will still work.

  5. #5
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Advantage of Enums is that you can use it as a returned value (for example in a function):
    Code:
    Public Enum enumMyColor
        RED = 1
        BLUE = 2
        GREEN = 3
        YELLOW = 4
    End Enum
    
    Public Function GetMyColor() As enumMyColor
        'Do something here
        
        'Return Color Value (for example red)
        GetMyColor = RED
    End Function

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