ascii

not sure if its the easiest but

Code:
Dim c As Char = "A"c
Dim b() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes(c)
MessageBox.Show(b(0).tostring)
 
the conversion from string to character doesnt 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; doesnt work
whats the deal?
 
or using the encoding method .....
Code:
        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))
 
Im 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))
 
heh well i guess i left out the part that im using c#

i want the c# = to this Dim c As Char = "A"c
 
Back
Top