|
-
Aug 27th, 2003, 12:32 PM
#1
Thread Starter
Fanatic Member
So I have this Enum...Need Help
So I have this enum:
VB Code:
Public Enum xyz
x = 1
y = 2
z = 5
End Enum
And i want to have a Select Case that checks for any of the values in the enum (1,2,5) but I don't want to write out a case statement for each enumeration item. I would like to just write one case statement to determine if the value is in the enumeration like:
VB Code:
Select Case myInt
Case In [Enum].GetValues(GetType(enuTopChainTypes))
End Select
Obviously this doesn't work, but I thing I am close. Anyone know how to do this?
-
Aug 27th, 2003, 01:18 PM
#2
Sleep mode
will something like this help you in any way :
VB Code:
Dim a As Integer
Select Case a
Case 1 To 4
Case 5 To 9
Case 10 To 14
End Select
-
Aug 27th, 2003, 01:55 PM
#3
Thread Starter
Fanatic Member
Not really. You know how you can do:
VB Code:
Select Case x
Case 1,2,5
...
End Case
Well, I want to use an array (that I get from the Enum.GetValues) instead of the 1,2,5. Or if there is some other way to do it...
-
Aug 27th, 2003, 02:24 PM
#4
How about this?
VB Code:
MsgBox([Enum].IsDefined(GetType(xyz), 1))
-
Aug 27th, 2003, 02:43 PM
#5
Thread Starter
Fanatic Member
That will definitely work! Thanks dude!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|