Thread: Using Enum Type
View Single Post
  #1 (permalink)  
Old June 4th, 2003, 03:33 PM
Mike2000 Mike2000 is offline
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Enum Type

I have Enum Type defined as followes:

Public Enum GenderType
    Male = 0
    Female = 1
End Enum

1)I am using following code to get Gender as input from user. If user entered 0 or 1 then program accepts but if user entered Male or Female it gives problem ? how the following code could be altered to work the way it accepts Male or Female as input.

        Dim PromptForGender as GenderType
        Console.Write("Please enter your gender: ")
        PromptForGender = Console.ReadLine

2)The other problem is when I tried to print from the object this gender type like contacts.GenderType it print 0 or 1 as it stored there. How I can show Male or Female instead of 0 or 1.

Help would be appreciated.

Thanks,