O
One Handed Man \( OHM - Terry Burns \)
I have a basic question thats been niggling me, but I never found time to
look at it before.
If I have an enumeration such as this
Fiend Enum TravelDirection
North
South
East
West
End Enum
and
Direction = TravelDirection
Now I want to set the Direction Randomly to one of the TravelDirection enum
values
If I know that my enum is between 1 and 4 I can easily get a new random
number and assign it, however, As I add to the enumeration, I wont want to
worry about coding all the changes, so how could I easily do this I know I
can do it, and I have but Im looking for the most simple solution. There
doesent seem to be a Max property for enumerations.
If this sounds dumb, then I appologise
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
look at it before.
If I have an enumeration such as this
Fiend Enum TravelDirection
North
South
East
West
End Enum
and
Direction = TravelDirection
Now I want to set the Direction Randomly to one of the TravelDirection enum
values
If I know that my enum is between 1 and 4 I can easily get a new random
number and assign it, however, As I add to the enumeration, I wont want to
worry about coding all the changes, so how could I easily do this I know I
can do it, and I have but Im looking for the most simple solution. There
doesent seem to be a Max property for enumerations.
If this sounds dumb, then I appologise
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--