Enum age
Over18
Under18
End enum
Select case age
End select
'age' is a type and cannot be used as an expression.
Is there any way of using enums in "select case"?
Enum age
Over18
Under18
End enum
Select case age
End select
'age' is a type and cannot be used as an expression.
Is there any way of using enums in "select case"?
That doesn't make sense. But you can do a Select Case on a variable that has the enum as its type.
Dim customerAge As age
customerAge = age.Over18
Select Case customerAge
Case age.Over18
...
Case age.Under18
...
End Select
I wouldn't think so. The Select Case is just a special If Then statement so the select has to have something to compare the answer to. So
Select childsAge
Case age.Over18
The enum "age" is indeed a type. You need to assign it to a variable built to hold it and test it that way:
Enum age
over18
under18
End enum
user.age = age.over18
Select case user.age
End Select
You will have to define a variable that uses the enum.
dim myage as age
myage = age.Over18
Select Case myage
case age.Over18
.....
case age.Under18
.....
end select
you can't use the type (age) on the expression, but you can use any variables of that type
Dim myAge As age
Select Case myAge Case age.Over18...