Difference between vbCrLf and vbNewLine

J

Jon Gilbert

Does anyone know of any guidelines to the use of vbCrLf and vbNewLine? They
both represent chr(13)+chr(10). Is vbCrLf just in there for compatibility?
Will it at some time be depracated in favor of vbNewLine?

Curious...
 
N

Nico Debeuckelaere

Jon,

Actually it is best to use "Environment.NewLine".
This takes the linefeed of the current operating system.
There are .NET ports on Linux that might have a different value for this
constant.

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
Pierstraat 135
B-2840 Rumst
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
C

Cor

Hi Jon,

In this VB net newsgroup I only see used vbCrLf
(And it is the only thing I use if I not use that chr(13) and/or chr(10))

Nice to see now 3 opinions.

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor said:
In this VB net newsgroup I only see used vbCrLf

Mhm... I always used the '*NewLine's because they seem to be more
"platform independet" and "high-level" than playing around with
character codes.

Just my 2 Euro cents.
 
H

Herfried K. Wagner [MVP]

* "William Ryan eMVP said:
As Nico points out, the Environment.NewLine is OS Agnostic so it's the
recommended way to go. Also, even in VB.NET, you may want to use
ControlChars.CrLf http://www.knowdotnet.com/articles/controlchars.html
But I'd still go with Envirnoment.NewLine

MSDN says that 'Environment.NewLine' will return "A string containing
"\r\n"". On the other hand, the docs say "Gets the newline string
defined for this environment". IMO that's a little bit misleading.
 
C

Cor

Did you actually use the word "Agnostic" to describe something in
computers?

I often think that a lot of people think that.

Although I should be carefully, Herfried is a specialist in this kind of
words.

:))

Cor
 

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