|
-
Sep 17th, 2003, 01:31 PM
#1
Thread Starter
Junior Member
Switch in VB?
Hi all,
Wanted to knof if there is something in VB (using Office 97) comprable to a switch command like in C++ such as
Switch (Variable) {
2: X = 5
3: x = 10
}
Otherwise, it's just a lot of if then statements that will make my code rather large and clunky.
Thanks,
Joshua Wise
-
Sep 17th, 2003, 04:37 PM
#2
Member
Hello,
Yes there is something like the switch statement in c++.
It is the select case statement.
Try the example and change the value of intChoice
--------------------------------------------------------
Dim intChoice As Integer
intChoice = 2
Select Case intChoice
Case 0
MsgBox "intChoice is 0"
Case 1
MsgBox "intChoice is 1"
Case Else
MsgBox "intChoice is in the else section."
End Select
End Sub
-----------------------------------------------------------
Greets,
J@B@R
-
Sep 17th, 2003, 04:42 PM
#3
Thread Starter
Junior Member
Thanks very much, I've never seen that before...guess that's the downfall of being an autodidact.
Peace,
Joshua Wise
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
|