dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Web
Expertise: Intermediate
Dec 1, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Create Line Breaks in the VID Label Object

The Visual InterDev label script object is a quick way to display text on your Web pages. Trouble is, the data from your recordset may contain line breaks that the label object ignores. The trick to passing line breaks to your label is to use the VBScript Replace() function. It converts the original carriage returns into HTML <BR> tags. In addition, you need to tell the label object to prepare for the <BR> tags and interpret them correctly on the page. If you don't include setDataFormatAs("html"), the label displays the tags instead of line breaks. This code shows the line break technique in action.

 
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Sub Button1_onclick()
Label1.setDataFormatAs("html")
Label1.setCaption(replace(Textbox1.value,chr(10),"<BR>"))
End Sub
</SCRIPT>

One more tip: Rather than using the setDataFormatAs() method in your code, you can check the "Data Contains HTML" box in the Label design-time control.

Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date