I suggest you ...

Using logical And operator in the Select Case statement

Select Case dblA
....Case Is > 1.22 And Is < 3.4

....Case Is > 4.1

....Case Else

End Select

Select Case sProductName
....Case Is > sPrevProdName And Is Like "* tea *"

....Case "apple juice"

End Select

14 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Robert EinhornRobert Einhorn shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    Hey everyone,

    If you hadn’t heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by “Roslyn”. You can download this preview and install it on top of Visual Studio 2013 today!

    I’m excited to let you know that included in this is a preview of a new language feature we’re considering: When clauses on Case statements. This behaves like an AND. It doesn’t do exactly as suggested because you can’t implicitly refer to the Select Case expression but you can test other conditions inside:

    Select Case dblA
    Case Is > 1.22 When Date.Today.DayOfWeek = DayOfWeek.Monday
    ’ Why would anyone ever write this?
    End Select

    You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

    Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

    I encourage you all to download it, try it out, and send us your feedback.

    Regards,

    Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base