convert byte array to ASCII

ar_pad

Active member
Joined
Jun 5, 2006
Messages
26
Programming Experience
Beginner
hi,
How to convert byte array to ASCII in VB.NET
System.Text.Encoding.ASCII.Getstring(y)
it gives the data like 52414D41 .
but i need "RAMA" instead of 52414D41.
How? Any help?
Thank U!
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,604
Location
Norway
Programming Experience
10+
How did the supposed text become a byte array? From where does it origin?
 

ar_pad

Active member
Joined
Jun 5, 2006
Messages
26
Programming Experience
Beginner
Solved!

I solved it .

Dim b As Byte
Dim s As String = ""
For inttemp As Integer = 0 To strhex.Length - 2 Step 2
b = System.Convert.ToByte(strhex.Substring(inttemp, 2), 16)
s &= Chr(b)
Next
Return s.

Thank You!
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,604
Location
Norway
Programming Experience
10+
Well, now when you say it, the coded string did resemble concenated hexadecimal values. Thanks for providing the solution!
 
Top Bottom