Results 1 to 4 of 4

Thread: [RESOLVED] get the actual name of an enumeration

  1. #1

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Resolved [RESOLVED] get the actual name of an enumeration

    Is there a way in vb6, as there is in .NET, to get the actual name of an enumeration constant ?

    ie:

    enum test
    one=0
    two
    end enum

    return "one" instead of 0

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: get the actual name of an enumeration

    No, but you could do this.

    vb Code:
    1. Option Explicit
    2. Private Enum test
    3. one = 0
    4. two
    5. End Enum
    6. Private EnumNames(1) As String
    7.  
    8. Private Sub Form_Load()
    9. EnumNames(0) = "one"
    10. EnumNames(1) = "two"
    11.  
    12. MsgBox EnumNames(one) ' ==> one
    13.  
    14. End Sub

  3. #3

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Resolved [resolved!]Re: get the actual name of an enumeration

    That'll work - thanks marty!

  4. #4

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