How to Indicate new line in TextBox

the_one2003a

Member
Joined
May 15, 2005
Messages
10
Programming Experience
Beginner
Hi

I am new to vb .net

I created a textbox and I want to represent every string of data in a new line but I don't know how.

In many languages (c,c++,php,..) '\n' would indicate the new line in a string but how can I do this in vb .net

Thanks alot
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,322
Location
Sydney, Australia
Programming Experience
10+
There are a few ways of adding a new line to a String but the preferred way in .NET is to use ControlChars.NewLine, e.g.:
VB.NET:
Dim multiLineString As String = "Line 1" & ControlChars.NewLine & "Line 2"
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
Or you could use an old fashion ... hahaha ;)

VB.NET:
Dim multiLineString As String = "Line 1" & Chr(10) & Chr(13) & Chr(10) & "Line 2"
but only within messageBox class as in textbox it adds some strange sign/character beween lines

Kind regards ;)
 

the_one2003a

Member
Joined
May 15, 2005
Messages
10
Programming Experience
Beginner
Thanks

Hi,

Thanks alot from both of you kulrom and jmcilhinney for your fast and nice answers.:) :p
 
Top Bottom