Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 30th, 2006, 02:13 AM
Registered User
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default select case

Hi Folks

I have a simple script

Select Case iThingy
Case 1,2,3
   code in here
Case 2
   more code in here
Case 3
   Some code in here
End Select

My query:
if iThingy = 3 why wont Case 3 display? It is only showing case 1,2,3



Old March 30th, 2006, 07:15 AM
Authorized User
Join Date: Mar 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts

Here's why:

From the link:

"If testexpression matches any Case expressionlist expression, the statements following that Case clause are executed up to the next Case clause, or for the last clause, up to End Select. Control then passes to the statement following End Select."

Old May 1st, 2006, 06:31 PM
Friend of Wrox
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts

The select case will execute the first matching case and it will only execute the code in one case. If a match is found, it will be the first match that executes.

In your case, the case with Case 1,2,3 matches on the three, the code in that case executes, and then the line after the End Select will execute.

Woody Z http://www.learntoprogramnow.com

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Case junaidraja30 Access VBA 1 February 5th, 2005 08:30 PM
select case yuvalk SQL Server 2000 4 August 25th, 2004 02:33 PM
Select Case morpheus VB How-To 1 August 13th, 2003 09:14 AM
Select Case andy24 Classic ASP Databases 5 July 25th, 2003 07:52 AM
Select Case ziwez0 .NET Web Services 8 July 11th, 2003 02:55 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.