dcsimg
 

ASP Q&A: The VBScript NewLine Character

ASP Q&A: The VBScript NewLine Character

What does Chr(10) mean when found in a web page’s code?

This is the fifth in a series of tips being posted based on the most read posts in one of our ASP Forums. (Previous Q&A)

Problem / Question:

How do you insert a new line when using VBscript? For example in JavaScript you can do the following:

Response.Write ("Here is my sentence .\n");

where \n" outputs a new line.

What is the syntax for VBscript?

Solution:

For VBScript, the approach would be to use vbCrLf:

Response.Write ("Here is my sentence" & vbCrLf)

The vbCrLf equates to doing a Chr(13) + Chr(10) combination. You could also use vbNewLine, which is replaced with whatever value the platform considers a newline. On Windows, the result of vbCrLf and vbNewLine should be the same.

Based on posts by forum members at ASPMessageBoard

This article was originally published on Wednesday Oct 19th 2016
Home
Mobile Site | Full Site