|
-
March 22nd, 2006, 02:32 PM
#1
How to make VB's select/case mimic C's switch/case
in C, I can do this
number=1;
switch(number)
{
case 1:
case 2:
case 3:
printf("\nCase 1-2-3");
break;
default:
break
}
in VB when I try to do this
number = 1
select case number
case 1
case 2
case 3
case else
'none of the above
end select
the case else path is taken.
It appears that the case in C are or'd but in vb they are not
I also tried this
number = 1
select case number
case 1 or 2 or 3
case else
'none of the above
end select
but the else path was taken again.
Is there something I'm missing, or can't this be done in vb ?
I don't want to check for a range of values, just a few discrete values.
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
|