Line terminator in VB.NET

  • Thread starter Thread starter chris
  • Start date Start date
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.
 
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.
 
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.
 
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'.
 
Back
Top