chr(13)

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

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

Thank you
 
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 said:
Use the following.
System.Environment.NewLine
 
Back
Top