468,760 Members | 1,720 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

How to get a ASCII value for a set of text?

Hi ! im working with asp.net(vb)
I need to get the ASCII value for a set of text which is typed in a text box.
I use a text box and a button, clicking on the button should show the equivalent ascii value for the text which is typed in the text box.
How do i achieve this?

Please provide a valid solution. Thanks in advance.
Jan 22 '08 #1
2 1045
Plater
7,872 Expert 4TB
You are referering to the decimal value for the individual characters in a string right?
Expand|Select|Wrap|Line Numbers
  1. char c= 'A';
  2. int asciivalue=(int)c;
  3. //now asciivalue is = to 65
  4.  
Then remember you can do something like this:
Expand|Select|Wrap|Line Numbers
  1. string mystr="Fred runs fast.";
  2. for(int i=0;i<mystr.Length;i++)
  3. {
  4.    char c=mystr[i];
  5.    int asciivalue=(int)c;
  6.    //now do something with the ascii value
  7. }
  8.  
Jan 22 '08 #2
Use the the
Expand|Select|Wrap|Line Numbers
  1. System.Convert.ToInt16
  2.  
method
Jan 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by webdev | last post: by
1 post views Thread by Kermit Piper | last post: by
1 post views Thread by Kermit Piper | last post: by
13 posts views Thread by greg | last post: by
7 posts views Thread by Jeffrey Spoon | last post: by
8 posts views Thread by ianenis.tiryaki | last post: by
4 posts views Thread by meendar | last post: by
9 posts views Thread by =?Utf-8?B?UGhhbmlkaGFy?= | 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.