I don't think I can do this, but I thought I would confirm with my most trusted VB source - you!
vb.net Code:
Select Case i Case 1, 2, 3 DoSomething() End Select
Can I tell if 1, 2, or 3 got me to DoSomething()?
Printable View
I don't think I can do this, but I thought I would confirm with my most trusted VB source - you!
vb.net Code:
Select Case i Case 1, 2, 3 DoSomething() End Select
Can I tell if 1, 2, or 3 got me to DoSomething()?
Inside the Case 1, 2, 3 you would have to check for what i is again to tell which caused it to step into that case
you'd be better off not testing for 1, 2, 3 and simply do a case for each
ie
Code:Select Case i
Case 1
Something
Case 2
Something
Case 3
And Something
End Select
Fair enough. Thanks!
Code:For testCTR As Integer = 0 To 10
Select Case testCTR
Case 0, 1, 2
Debug.WriteLine(testCTR.ToString.PadRight(3, " "c) & "0, 1 or 2")
Case 3
Debug.WriteLine(testCTR.ToString.PadRight(3, " "c) & "3")
Case 4 To 7
Debug.WriteLine(testCTR.ToString.PadRight(3, " "c) & "4 - 7")
Case Else
Debug.WriteLine(testCTR.ToString.PadRight(3, " "c) & "other")
End Select
Next
That still doesn't help him any, once he's inside the case of 1, 2 or 3, he'll still have to test i again to find out if it stepped in because i was a 1, 2 or a 3.Quote:
Originally Posted by dbasnett