Question Convert byte array to hex

thunderchild

New member
Joined
Oct 30, 2008
Messages
1
Programming Experience
5-10
Hi All

I'm reading a byte array in from a usb device using ports and I need to convert this byte array into hex. I have the following code
VB.NET:
  Dim inbuffer(12) As Byte
port.Read(inbuffer, lastoffset, Buffersize).ToString()
port.BaseStream.Read(inbuffer, lastoffset, Buffersize)
Dim strString As String

strString = System.Text.Encoding.ASCII.GetString(inbuffer)
Dim hexBinary As SoapHexBinary = SoapHexBinary.Parse(strString)
 Label2.Text = hexBinary.ToString


Now inbuffer has 186 at pos 7 but strString is blank "", so obvisouly the next line of code throws an exception. Can anyone tell me where i'm goin wrong please.

Many Thanks
Thunderchild
 
Back
Top