Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

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.

  • *Experts*
Posted
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.

  • Leaders
Posted

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. :)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...