I Am trying to read bytes from a binary file
VB6 Code
Dim bTest1() As Byte
Dim hFile As Long
hFile = FreeFile
Open (sNewFile) For Binary As hFile
'btest1 is the byte array containing all the files data
'LOF(1) return the length of the file -
'in our case 1 represent the file handle
ReDim bTest1(LOF(1))
Get #1, , bTest1
'Get Stdjob Name stored in bytes 302 -311
For i = 302 To 311
strStdJob = strStdJob & Chr$(bTest1(i))
Next i
close #1
When this code executes strStdJob contain = 'STYLES' which is the name stored in bytes 302 to 311 of the binary file.
VB.NET 2008 Code
FileOpen(hFile, (sNewFile), OpenMode.Binary)
ReDim bTest1(LOF(1))
FileGet(1, bTest1)
For i = 302 To 311
strStdJob = strStdJob & Chr(bTest1(i))
Next i
FileClose(1)
When I execute this code in vb.net 2008 strStdJob is null or empty. why?
One thing I found is the Chr$ does not exist in vb.net
How do I transalete the above vb 6 code to vb.net
Thanks in advance
Ed
VB6 Code
Dim bTest1() As Byte
Dim hFile As Long
hFile = FreeFile
Open (sNewFile) For Binary As hFile
'btest1 is the byte array containing all the files data
'LOF(1) return the length of the file -
'in our case 1 represent the file handle
ReDim bTest1(LOF(1))
Get #1, , bTest1
'Get Stdjob Name stored in bytes 302 -311
For i = 302 To 311
strStdJob = strStdJob & Chr$(bTest1(i))
Next i
close #1
When this code executes strStdJob contain = 'STYLES' which is the name stored in bytes 302 to 311 of the binary file.
VB.NET 2008 Code
FileOpen(hFile, (sNewFile), OpenMode.Binary)
ReDim bTest1(LOF(1))
FileGet(1, bTest1)
For i = 302 To 311
strStdJob = strStdJob & Chr(bTest1(i))
Next i
FileClose(1)
When I execute this code in vb.net 2008 strStdJob is null or empty. why?
One thing I found is the Chr$ does not exist in vb.net
How do I transalete the above vb 6 code to vb.net
Thanks in advance
Ed