473,382 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 12524
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Eddie B. | last post by:
Does anyone know how to do Chr$(13) in .NET? Thanks, Eddie
6
by: C L Humphreys | last post by:
Hi, I'm trying to concatenate address fields and insert a LF&CR after each line. The SQL I use is based on select address1 & chr(10) & chr(13)& address2 & chr(10) & chr(13)& address3 & ...
1
by: jdph40 | last post by:
I am trying to enter text to look like paragraphs in a text box on a report, making it look like a memo. I enter (Chr$(13) & Chr$(10) & Chr$(10)) to insert a carriage return and 2 line breaks, but...
2
by: lauren quantrell | last post by:
Has anyone cunstructed a function to remove multiple carriage returns and replace it with a single return? Replace(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) & Chr(10)) ... only...
2
by: MLH | last post by:
I run the following command in main menu form open event code... Me!MainMenuLabel.Caption = DLookup("", "qryAdminList") & Chr$(10) & Chr$(13) & DLookup("", "qryAdminList") & Chr$(10) & Chr$(13)...
2
by: crjunk | last post by:
I have the following code in my web page. Dim tmpReplace As String 'Giving tmpReplace the value from the textbox on the webform. tmpReplace = txtComments.Text.Trim 'Prevents report from...
10
by: Dan Nash | last post by:
Lo, In a previous version of an app, I used replace to convert multiline text boxes to something easier to put in a database, and then i used replace(chr(13), "<br>") when i needed to show the...
1
by: Felix | last post by:
We have a problem with the Chr(13) and WebServices (we are using VB.NET 2003). If we have a string that contains the Chr(13) and the Chr(10) (just the vbCrLf characters) and we pass it through a...
5
by: Computer Guru | last post by:
I have a form I'm using as a dialog box. It has default text that is two paragraphs. It has a function setText(byval text as string) that specifies the text in the read-only textbox that's on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.