Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

case switch 1

Status
Not open for further replies.

rotschreck

Programmer
Jan 26, 2000
54
CA
Hi, so I'm a little rusty on my VB.<br>
Been doing VC for a couple of years now...<br>
<br>
Is there a function that simulates Case / Switch in VB?<br>
<br>
or is there an easier way than a whole bunch of If Thens? <p> <br><a href=mailto: > </a><br><a href= Eclectic Page</a><br>
 
Well seeing as how we a VB gurus an Not &quot;C&quot;<br>
I don't know what Case Switch is.<br>
But there is a &quot;Select Case&quot; statement<br>
and here are it's parts<br>
<br>
Select Case x<br>
Case A<br>
CASE B<br>
Case C<br>
Case Else<br>
End select<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
DougP is right. The Select Case statement in VB is very similar to the Switch statement. The Select Case statement even adds a little more functionality because it allows you to use math operators in your case statements like &lt; or &gt;.<br>
<br>
Aleena
 
Like DougP said, plus you don't have to put break statements at the end of every case condition to prevent the thread of execution from falling through.<br>
<br>
That alone is a big advantage, in my book.<br>
<br>
Chip H.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top