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,
|