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'.
 

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

Back
Top