No_Comment
08-26-2009, 08:12 AM
I want to create a bytearray from a richtextbox just like a bytearray will be created here:
Dim bytearr As Byte
Open "c:\test.exe" For Binary As #1
ReDim bvTmp(LOF(1) - 1)
Get #1, , bytearr
Close #1
But in this application i want the result in the bytearray to be the same as in the code above
http://img228.imageshack.us/img228/6194/hex2.jpg
Dim bytearr() As Byte
bytearr() = HexToString(r1.Text)
With this Function:
Public Function HexToString(ByVal HexToStr As String) As String
Dim strTemp As String
Dim strReturn As String
Dim I As Long
For I = 1 To Len(HexToStr) Step 2
strTemp = Chr$(Val("&H" & Mid$(HexToStr, I, 2)))
strReturn = strReturn & strTemp
Next I
HexToString = strReturn
End Function
But it's not the same. Can someone please help me out.
Dim bytearr As Byte
Open "c:\test.exe" For Binary As #1
ReDim bvTmp(LOF(1) - 1)
Get #1, , bytearr
Close #1
But in this application i want the result in the bytearray to be the same as in the code above
http://img228.imageshack.us/img228/6194/hex2.jpg
Dim bytearr() As Byte
bytearr() = HexToString(r1.Text)
With this Function:
Public Function HexToString(ByVal HexToStr As String) As String
Dim strTemp As String
Dim strReturn As String
Dim I As Long
For I = 1 To Len(HexToStr) Step 2
strTemp = Chr$(Val("&H" & Mid$(HexToStr, I, 2)))
strReturn = strReturn & strTemp
Next I
HexToString = strReturn
End Function
But it's not the same. Can someone please help me out.