Library tutorials & articles

Select Case statement

Page 1 of 3
  1. Introduction
  2. Syntax
  3. Usage

Introduction

The Select Case statement is an alternative to the If...Then...Else statement. It also makes code easier to read especially when testing lots of different conditions. It also makes the code more efficient.

Comments

  1. 12 Sep 2004 at 16:46

    You want Case "SomeString", "NoString".

  2. 17 Mar 2004 at 06:37

    This below code segment throws casting exception
    Select Case str1
               Case "SomeString" Or "NoString"
                   Response.Write("OK")
               Case "SmallString" And "BigString"
                   Response.Write("AND here")
           End Select


    Can you please explain the structure of Case statement in detail ?
    Thanx in Adv.

  3. 27 Jan 2002 at 22:17

    If you put the Case Is statement first, will it run this message box and not look at the others?

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Select Case statement.

Leave a comment

Sign in or Join us (it's free).

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

We'd love to hear what you think! Submit ideas or give us feedback