By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Negate a Select Case Statement

P: n/a
How do I do the following?
Select Case(SomeValue)

Case NOT A, M, Q, Y
'Do stuff if it is not A,M,Q,Y
End Select
Currently I have

Select Case(Somevalue)
Case A, M, Q, Y

Case Else
'Do Stuff
End Select

But surely NOT must work? I also tried Case IS <> A, M, Q, Y but that
doesn't seem to work properly.

Thanks.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default
'Do stuff not in any other case
End Select

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
How do I do the following?
Select Case(SomeValue)

Case NOT A, M, Q, Y
'Do stuff if it is not A,M,Q,Y
End Select
Currently I have

Select Case(Somevalue)
Case A, M, Q, Y

Case Else
'Do Stuff
End Select

But surely NOT must work? I also tried Case IS <> A, M, Q, Y but that
doesn't seem to work properly.

Thanks.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 20 '05 #2

P: n/a
* "Cowboy \(Gregory A. Beamer\) [MVP]" <No************@comcast.netNoSpamM> scripsit:
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default

^^^^^^^

'Case Else'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a
"Cowboy \(Gregory A. Beamer\) [MVP]" <No************@comcast.netNoSpamM>
wrote in news:#E**************@TK2MSFTNGP09.phx.gbl:
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default
'Do stuff not in any other case
End Select


But I want to negate A, M, Q, Y.

So do stuff when NOT A, M, Q,Y.

I guess I'll stick with the Case Else for now.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #4

P: n/a

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default
'Do stuff not in any other case
End Select


Attention Security Personnel: C# user detected in grid 7. Annihilate!
Nov 20 '05 #5

P: n/a
Try this:

Select case (somevalue)
case is <> A, is <> B, .......
Do you thing here
case something else

End Select

--
Dennis in Houston
"Jeff Johnson [MVP: VB]" wrote:

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default
'Do stuff not in any other case
End Select


Attention Security Personnel: C# user detected in grid 7. Annihilate!

Nov 20 '05 #6

P: n/a
guy
dont annhilate him - turn him - with a double agent in the camp maybe we could find out what C# *** really *** keeps inside its curly braces!

guy

"Jeff Johnson [MVP: VB]" wrote:

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Select Case(SomeValue)
Case A, M, Q, Y
'Do stuff for this
Default
'Do stuff not in any other case
End Select


Attention Security Personnel: C# user detected in grid 7. Annihilate!

Nov 20 '05 #7

P: n/a
Hi Lucas,
Select Case(SomeValue)
Case A, M, Q, Y
'Do nothing
Case Else
'Do your stuff
End Select

I hope this helps?

Cor
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.