Like operator

Cassio

Junior Contributor
Joined
Nov 30, 2002
Messages
276
Location
Rio de Janeiro
Is there a way I can use the Like operator in a select case stetement? I want it to have the same effect of statement below:

Visual Basic:
If m Like "200*" then
     'code
Elseif m Like "test*" then
    'code
end if

But there are many conditions to test and the select case would look better.

Thanks.
 
Visual Basic:
Select Case True
  Case m Like "200*"
    'code
  Case m Like "test*"
    'code
End Select
That's really the only way to do it. Not much different than the If block really.
 
I doubt there's any performance difference... both of these will check for a True condition, run specified code, and exit the entire block.
Personally, I use Select Case for selecting from a list of choices of a datatype, and otherwise, If statements. :)
 
Back
Top