Epicserve

Note to self... VBScript / ASP doesn't call a switch statement a switch statement

June 4, 2004 | 1:56 p.m. CDT

I just spent like twenty minutes searching Google for the syntax for a VBScript switch statement only to find out that VBScript calls it a select statement.

Why on earth does VBScript call it a select statement when every other language calls it a switch statement? I guess that's Microsoft for you! :)

Related tags: Select, Switch, VBScript

Comments

Peter
1.   At 2:09 p.m. CST on Nov. 30, 2004, Peter wrote:

Thanks for the note! I was doing the same google hunt when I found your post. Guess I saved myself about 10 minutes. ;)

Danny
2.   At 7:10 p.m. CST on Dec. 19, 2004, Danny wrote:

I just found your post via google when I was looking for information on switch statements in VBScript.

Cheers!

Evan Chaney
3.   At 7:02 p.m. CST on Dec. 27, 2004, Evan Chaney wrote:

Same. Thanks!

JT
4.   At 10:02 a.m. CST on Jan. 4, 2005, JT wrote:

I think the actual nomenclature is "case" statement

But I'm stupid as you lot and got to this page googling for "vbscript switch" too ;)

Switching (pun intended) my brain between javascript and vbscript isn't easy

Franz
5.   At 2:03 p.m. CST on March 7, 2007, Franz wrote:

Thanks for the info

crazy
6.   At 12:43 p.m. CST on Jan. 27, 2008, crazy wrote:

same here ... i googled "asp vbscript switch" lol :) VBscript is a *$ù$°+# a language ...

Peter
7.   At 10:53 a.m. CDT on June 11, 2008, Peter wrote:

Same here

saurav
8.   At 5:30 a.m. CDT on June 28, 2008, saurav wrote:

I did the same, you saved my 15 minutes

Dodo
9.   At 12:22 a.m. CDT on Aug. 9, 2008, Dodo wrote:

Give you an example:

select case n case 0 : statement1 case 1 : statement2 End Select

Cathy
10.   At 8:08 p.m. CDT on Sept. 10, 2008, Cathy wrote:

I am in the same boat too :) MS tries to waste other people time. Thanks

Chris
11.   At 2:30 p.m. CST on Nov. 21, 2008, Chris wrote:

I can never remember the syntax for the VB 'switch' statement, and have to google it everytime. Here's a post for me for future references:

dim n as String

select case n case "hello","hi": gohere() case "Somethingelse": return case default: gosomewhere_else() End Select

also, so anyone else in the future has some more example to go after

chris
12.   At 2:38 p.m. CST on Nov. 21, 2008, chris wrote:

Sorry bout the report ... i should google before i open my mouth :)

1) you dont use colons ( : ) 2) the 'default' should be 'Else' : Case Else DoOther() End Select

Yikes
13.   At 2:33 p.m. CST on Dec. 15, 2008, Yikes wrote:

Glad to see i'm not the only one... sheesh

damn VBScript
14.   At 11:38 a.m. CST on Feb. 2, 2009, damn VBScript wrote:

LOL, googled "vbscript switch case"

Nice One
15.   At 8:51 p.m. CST on March 3, 2009, Nice One wrote:

Thank you so much for posting this.

This page came up #4 in altavista (my search engine of choice) and it saved me tons of effort.

I knew it wasn't called switch, but I couldn't remember what it was. Thanks for posting this!

Redsandro
16.   At 3:28 a.m. CST on Dec. 4, 2009, Redsandro wrote:

Heh, posted more than 5 years ago and still helping out people. I also got here trough google. 3rd hit. Problably saved me 20 minutes!

I fricking hate .VBS but it's either that or .Batch when you want to customize windows through some scripts.

Thanks :)

Post Your Comment

(Optional & Not Displayed)

(Optional)


(allowed tags - strong, em, cite, & code)

Post Guidelines

Please be considerate of others. Keep comments relevant. Content deemed inappropriate or offensive may be edited and/or deleted. Email addresses are never displayed.

Line breaks and paragraphs are automatically converted — no need to use p or br/. Quotes, apostrophes, and double-dashes are automatically converted to smart punctuation. Be careful when copying and pasting portions of entries or other comments.

Links can be created using the standard <a href="http://url">urlName</a>. The following inline HTML elements may also be used: strong, em, cite, & code. The title attribute is allowed within any element. All other code will get removed before posting.