473,327 Members | 1,979 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,327 software developers and data experts.

VB.Net chr() equivalent in C#.net

Hi Techies,

Could you please let me know the equivalent of VB.Net chr() in C#.net?

Regards,
Vasanth
Nov 16 '05 #1
6 12919
"Vasanth" <va********@yahoo.com> wrote in message
news:48*************************@posting.google.co m...
Hi Techies,

Could you please let me know the equivalent of VB.Net chr() in C#.net?


If you're looking to generate the "normal" ASCII keycodes, e.g. A-Z, 0-9
etc, then the C# equivalent of the VB.Net Chr(65) is (char)65. However, if
you're looking for the other characters e.g. escape sequences, CrLf etc, you
need to use things like \n, \r etc.

The following site should be of help to you:

http://www.harding.edu/USER/fmccown/...omparison.html
Nov 16 '05 #2
fyi the framework provides Environment.NewLine constant for the \n\r escape
sequence.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:eZ*************@TK2MSFTNGP10.phx.gbl...
"Vasanth" <va********@yahoo.com> wrote in message
news:48*************************@posting.google.co m...
Hi Techies,

Could you please let me know the equivalent of VB.Net chr() in C#.net?
If you're looking to generate the "normal" ASCII keycodes, e.g. A-Z, 0-9
etc, then the C# equivalent of the VB.Net Chr(65) is (char)65. However, if
you're looking for the other characters e.g. escape sequences, CrLf etc,

you need to use things like \n, \r etc.

The following site should be of help to you:

http://www.harding.edu/USER/fmccown/...omparison.html

Nov 16 '05 #3
John Wood <sp**@isannoying.com> wrote:
fyi the framework provides Environment.NewLine constant for the \n\r escape
sequence.


Other way round - "\r\n". However, that's not what it's *defined* to be
- it's defined to be the default line separate for the platform. That
means that on Mono it's (I would imagine) "\r\n" for Windows and "\n"
for Linux, for example.

In my view, it should only be used when writing text files to be read
on that platform - if you're trying to conform to a protocol which
specifies which line separator to use, you should use that exact string
rather than Environment.NewLine.

--
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
> Other way round - "\r\n".
You're just here to point out my typos aren't you.

In my view, it should only be used when writing text files to be read
on that platform - if you're trying to conform to a protocol which
specifies which line separator to use, you should use that exact string
rather than Environment.NewLine.


So, here's a question for you, does StreamWriter::WriteLine use
Environment.NewLine or \r\n?
Nov 16 '05 #5
John Wood <sp**@isannoying.com> wrote:
Other way round - "\r\n".

You're just here to point out my typos aren't you.


LOL. I thought I'd mention it in passing :)
In my view, it should only be used when writing text files to be read
on that platform - if you're trying to conform to a protocol which
specifies which line separator to use, you should use that exact string
rather than Environment.NewLine.


So, here's a question for you, does StreamWriter::WriteLine use
Environment.NewLine or \r\n?


According to the docs, it defaults to "\r\n" - but you can change it
using the TextWriter.NewLine property.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
Hi All,

Thanks for your suggestions.

Regards,
Vasanth

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #7

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
3
by: charliewest | last post by:
Can anyone tell me what the C# equivalent of the VB Chr() Function? I need to insert a single-byte character into a label control at run time. For example: Dim s = "Hello" + Chr(32)
3
by: Alberto | last post by:
In a application in visual basic 6 I had chr$(13). How can I get the same value in C#? Thank you
9
by: INeedADip | last post by:
'Asc' returns an Integer value representing the character code corresponding to a character 'Chr' is the inverse and returns the character associated with the specified character code What...
1
by: sakina | last post by:
I am trying to change some code from VB to C#. I have a variable called pstrHex with a value of "49799879A7E109F3B4BB4224257E50B5" in VB, the following code: HexToString = HexToString &...
5
by: Christian Blackburn | last post by:
Hi Gang, I would like to use a caesar cipher on the mailto: links in my website to prevent crawlers from farming the e-mails off my site. Can someone tell me the equivalents to Chr() and Asc()...
0
by: basudahal | last post by:
I am trying to convert from VB to C#. Could you help me with Chr$(&HD) or Chr$(&HA) equivalent to C#? I would really appreciate.
7
by: Zytan | last post by:
I am trying to set a const string made up of Chr(), but if the value passed into Chr() is too large, the compiler complains that it is not constant!! Example: Public Const m_Data As String =...
4
by: David Griffiths | last post by:
Hi all I thought I would convert an old program to use just .net, removing the Microsoft.Visual Basic namespace. I seem to have succeeded except for just one are. What is the .net equivalent...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.