Thanks I think I got it now
This may not be the best way but it does appear to work properly. It was returning some hex values as only one char so I had to get it to buffer with a leading 0 for those. I have not tried converting back from the hex value to the Binary value. I think I understand enough now to get it to work though. If you think this code could be done better please let me know.
Thanks,
Richard
'<-------Begin Code------->
Const ChunkSize = 1
Dim Data As String
Dim HexData As String
Public Sub Form_Load()
Me.Show
Open "C:\Test.bin" For Binary As #1
Do Until LOF(1) = Loc(1) Or EOF(1)
Data = ""
If LOF(1) - Loc(1) < ChunkSize Then
Data = String(LOF(1) - Loc(1), 0)
Else
Data = String(ChunkSize, 0)
End If
Get #1, , Data
If Len(Hex(Asc(Data))) = 1 Then
HexData = "0" & Hex(Asc(Data)) & " "
ElseIf Len(Hex(Asc(Data))) = 2 Then
HexData = Hex(Asc(Data)) & " "
Else
MsgBox "(" & Hex(Asc(Data)) & ") was returned", vbExclamation, "There was an error"
End If
Text1.Text = Text1.Text & HexData
Loop
End Sub
'<-------End Code------->