Hi all,
Is there a way to make a VB case statement evaluate all the cases? Similar to a java switch statement (without the break).
Thanks,
Strick
Printable View
Hi all,
Is there a way to make a VB case statement evaluate all the cases? Similar to a java switch statement (without the break).
Thanks,
Strick
I would say there is not way in vb.net to do this using a select case statement. here's what we find on MSDN :
"If testexpression matches any Caseexpressionlist clause, the statements following that Case statement are executed up to the next Case statement or the End Select statement. Control then passes to the statement following End Select. If testexpression matches an expressionlist clause in more than one Case clause, only the statements following the first match are executed."
I' guess you would need to use multiple "if" statement to do what you need.
Hi,
Thanks for your reply. Figured as much just thought I'd ask. If statements it is then... :ehh:
If <Case1> Then
End If
If <Case2> Then
End If
'Repeat
if there is no break; statement in a case statement then all the case statement might evaluate by default
how about using "Finally" after all your cases? put all the code you want to execute in the Finally block.
i'm curious though, if you're trying to execute ALL the cases, why even have the Select/Case structure? wouldn't you just... 'do' it all minus all the Select/Case code?