Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to comment out a block of code in ASP VB Script

Status
Not open for further replies.

michellerobbins56

Programmer
Jan 10, 2006
89
GB
Hi

Is there a way to comment out a block of code in ASP / VBscript as opposed to using ' before each line? In Javascript you can use /* block */ but have yet to find a similar QUICK way of doing the same in ASP.

From searching on Google it doesn't seem as though it's possible - other than spending extra time creating a Logic if statement to execute code which is not something I want.

Thanks for any help or comments (no pun intended)...
 
Nope, single-line is all you have. however if your using a decent editor you should be able to create a macro for commenting and uncommenting multiple lines. In Editplus I recorded two search and replaces: "^","'" and then "^'",""
Added those as user tools. Now when I want to comment out a block of code I just select the lines and hit Ctrl+3, and to uncomment the block is Ctrl+4.

 
Thanks for your reply. I use Visual Studio Interdev. Is there a similar way in this package?
 

One option would be to do:

Code:
Response.write("the code you DO want to run before the block goes here")

[!]if "Run"="No" then[/!]
  Response.write("the code you don't want to run goes here")
  Response.write("the code you don't want to run goes here")
  Response.write("the code you don't want to run goes here")
  REsponse.end
[!]end if[/!]

Response.write("the code you DO want to run after the block goes here")

but that's cheating a bit ;-)



A smile is worth a thousand kind words. So smile, it's easy! :)
 
EditPlus has a toolbar button to comment/uncomment a block of code. It does ask that you enter the comment character, which seems strange. No reason why it shouldn't be able to tell that from the file extenstion, like it does for syntax highlighting.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
The other options answered above notwithstanding, there is no native way in Interdev to do what you're asking other than doing it line-by-line.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
please refer to this thread

thread333-1111790

i already posted solution to it...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top