Line terminator in VB.NET

C

chris

I am using the System.Text.StringBuilder to build a string. I want to append line terminators to this string. In C# I would use "\n". What is the equivalent in VB.NET?

Also, is there a line terminator property somewhere in the .NET FCL for building strings?

I have been surprised how hard it is to find an answer to this question. My background is not VB so may be it is assumed knowledge.
 
T

Tracey

Try environment.newline.

-----Original Message-----
I am using the System.Text.StringBuilder to build a
string. I want to append line terminators to this
string. In C# I would use "\n". What is the equivalent
in VB.NET?
Also, is there a line terminator property somewhere in
the .NET FCL for building strings?
I have been surprised how hard it is to find an answer
to this question. My background is not VB so may be it
is assumed knowledge.
 
F

Fergus Cooney

Hi Chris,

As Tracey says, environment.newline will do the job. This will give you
the appropriate string for the environment in which your app is running
[strangely enough :)].

If you know you'll be sticking to Windows, you might prefer the shorter
vbCrLf.

Regards,
fergus.
 
H

Herfried K. Wagner [MVP]

chris said:
I am using the System.Text.StringBuilder to build a string. I want to append line terminators to this string. In C# I would use "\n". What is the equivalent in VB.NET?

Also, is there a line terminator property somewhere in the .NET FCL for building strings?

I have been surprised how hard it is to find an answer to this question. My background is not VB so may be it is assumed knowledge.

'Environment.NewLine' or 'ControlChars.NewLine'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top