Thursday, March 22, 2012

newline character - easy question

A Stupidly easy question - what is the newline character for VB.NET?

I have tried:
label.text = "first line \n second line"
and it doesnt work.

JagsYou could use VBCrlf or Environment.NewLine
If you want value in labe to come in next line then you have to use

"first line <br> second line"

[VBCrlf or NewLine dosn't work in HTML. So you have to use <br>]

hope it helps!
The VBCrlf was the one I wanted. Just wondering if I could put that into a sctring, i.e. instead of writing

label.text = "The is the first " & VBCrlf & "This is the second"

I could write something like

label.text = "This is the first \VBCrlf This is the second"
You can't do as below

label.text = "This is the first \VBCrlf This is the second" as it treates as a word in the string!

0 comments:

Post a Comment