468,765 Members | 803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

chr(13)

In a application in visual basic 6 I had chr$(13). How can I get the same
value in C#?

Thank you
Nov 16 '05 #1
3 12074
Alberto <al*****@nospam.com> wrote:
In a application in visual basic 6 I had chr$(13). How can I get the same
value in C#?


'\r' will do it...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Use the following.
System.Environment.NewLine

Jon Skeet [ C# MVP ] wrote:
Alberto <al*****@nospam.com> wrote:
In a application in visual basic 6 I had chr$(13). How can I get the same value in C#?


'\r' will do it...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #3
On the Windows platform, Environment.NewLine yields a carriage return AND a
line feed, so it wouldn't be equivalent to VB's Chr(13). It'd be equivalent
to vbCrLf.

As info to the OP, "\n" is a line feed (newline), so on Windows,
Environment.NewLine == "\r\n";

For just a carriage return, you would embed \r into the string, e.g.

'VB
string = "Foo" & Chr(13) & "Bar"

//C#
string s = "Foo\rBar";
//or
string s = String.Format("Foo{0}Bar","\r");
//or
string s = "Foo" + "\r" + "Bar";

--Bob

"firebalrog" <pa************@hotmail.com> wrote in message
news:11********************@g14g2000cwa.googlegrou ps.com...
Use the following.
System.Environment.NewLine

Jon Skeet [ C# MVP ] wrote:
Alberto <al*****@nospam.com> wrote:
> In a application in visual basic 6 I had chr$(13). How can I get the same > value in C#?


'\r' will do it...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Eddie B. | last post: by
6 posts views Thread by C L Humphreys | last post: by
2 posts views Thread by lauren quantrell | last post: by
10 posts views Thread by Dan Nash | last post: by
1 post views Thread by Felix | last post: by
5 posts views Thread by Computer Guru | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.