Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i use Select Case with and operator?
Thanks.
Dim Contition 
Select Contition 
Case c1 = 0 And c2 = 0 And s3 = True
Case c1 = 0 And c2 = 0 And s3 = False
Case c1 = 1 And c2 = 0 And s3 = false
Case c1 = 2 And  s3 = True
Case Else
End Select


What I have tried:

Dim Contition 
Select Contition 
Case c1 = 0 And c2 = 0 And s3 = True
Case c1 = 0 And c2 = 0 And s3 = False
Case c1 = 1 And c2 = 0 And s3 = false
Case c1 = 2 And  s3 = True
Case Else
End Select
Posted
Updated 12-Jun-19 15:06pm

1 solution

Yes, but only if your "Condition" expression evaluates to a Boolean value (True or False.)
 
Share this answer
 
Comments
gacar 12-Jun-19 21:23pm    
Thanks for answer. If so, sad.
Dave Kreskowiak 12-Jun-19 22:47pm    
In your particular situation, all of your Case statements return Boolean values, so the textExpression (your "Condition") also has to be a Boolean.

What did you expect to happen?
gacar 13-Jun-19 6:13am    
Yes right. But i couldn't make condition variable that have and operators. Is it possible?
Dave Kreskowiak 13-Jun-19 9:22am    
Show the code. Your description doesn't make sense.
[no name] 18-Jun-19 8:14am    
yeah, that is for sure

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900