Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Simple syntax question: Select Case (ranges)
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

gelliott
Junior Member

USA
268 Posts

Posted - 04 October 2003 :  22:50:46  Show Profile
OK, this is kicking my tail, and Microsoft's online documentation is vague (it says an expression list can be used but gives no examples of a range's syntax). Why won't this work?!?
testVal = 5
if IsNumeric(testVal) then
	Select Case testVal
	     Case 4 To 11, 98 To 100, 178  ' Zone A
	          strZone = "A"
	     Case Else
	          strZone = "notfound"
        End Select
End if
IIS 5 keeps giving me an error "Microsoft VBScript compilation (0x800A0400) Expected statement". If I change the To to a - I don't get the error but the number always results in the case else unless it's the one listed individually (178 in the example above). Other VB references usually use the to keyword To specify ranges in these situations... HELP?

* The optimist says the cup is half full. The pessimist says it's half empty. But the engineer knows the truth - the cup's design is incorrectly sized.

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 04 October 2003 :  23:53:01  Show Profile  Visit Gremlin's Homepage
It doesn't except ranges afaik you'd need to use Case 4,5,6,7,8,9,10,11,98,100,178 instead.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 05 October 2003 :  00:54:51  Show Profile
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsgrpNonFeatures.asp

Look for Select Case in the table ... using To in a Select Case is not supported in vbscript.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

gelliott
Junior Member

USA
268 Posts

Posted - 05 October 2003 :  13:05:19  Show Profile
Aarrghh!!! OK, well at least now I know I'm not going crazy... Thanks guys and gals!

* The optimist says the cup is half full. The pessimist says it's half empty. But the engineer knows the truth - the cup's design is incorrectly sized.
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 05 October 2003 :  14:09:03  Show Profile  Visit dayve's Homepage
this is something that has ALWAYS bugged me... however using nested IF..THEN..ELSE routines always work out fine.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07