bpayne111 Posted November 25, 2003 Posted November 25, 2003 how do convert a character to it's ascii value ? Quote i'm not lazy i'm just resting before i get tired.
Administrators PlausiblyDamp Posted November 25, 2003 Administrators Posted November 25, 2003 not sure if it's the easiest but Dim c As Char = "A"c Dim b() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes(c) MessageBox.Show(b(0).tostring) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bpayne111 Posted November 26, 2003 Author Posted November 26, 2003 the conversion from string to character doesn't work like it does in vb apparently i got my code to work but now im curious as to i how convert "A" to a char quickly and easily since char c = "A"c; doesn't work what's the deal? Quote i'm not lazy i'm just resting before i get tired.
Leaders dynamic_sysop Posted November 26, 2003 Leaders Posted November 26, 2003 have you not tried this then.... MessageBox.Show(Asc("A")) Quote
Leaders dynamic_sysop Posted November 26, 2003 Leaders Posted November 26, 2003 or using the encoding method ..... Dim b() As Byte = Encoding.ASCII.GetBytes("A".ToCharArray) Dim s() As Byte = Encoding.ASCII.Convert(System.Text.Encoding.UTF8, System.Text.Encoding.ASCII, b) MessageBox.Show(s(0)) Quote
cloud Posted November 26, 2003 Posted November 26, 2003 I'm not totally sure whether this method is what u are looking for.. But here is it.. Dim myCon As Char myCon = "a" TextBox1.Text = Convert.ToString(Convert.ToInt32(myCon)) Quote
tate Posted November 26, 2003 Posted November 26, 2003 Do you want to convert a byte string that represents a hex value to ascii? Quote
bpayne111 Posted November 26, 2003 Author Posted November 26, 2003 heh well i guess i left out the part that i'm using c# i want the c# = to this Dim c As Char = "A"c Quote i'm not lazy i'm just resting before i get tired.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.