J
Jason Roozee
I have submited previous posts about this but still have not come toa
conclustion. I have a crystal report file which is obviously not a text
file, it's a binary file. I want to open the file and store every single
byte of it's data in to a string variable. In my attempts using a
BinaryReader object, I've had no success. I either only get some of the data
or I get a error when PEEKing the data "Index was outside the bounds of the
array".
I have the book "Programming Microsoft Visual Basic .NET" by Microsoft as
my guide to my transision from VB6 to .NET.
In VB6 I would typically use the following code:
Dim strFileData as string
Open fileName for binary access read as #1
strFileData = string$(lof(1), 0)
get #1, , strFileData
Close #1
However, In .NET, it seems impossible. I have attached the file I am trying
to store in to a string so that anyone who would like to try to help me can
have a look at the data I am trying to store. No one seems to be able to
have an answer!
I've tried this in .NET:
Dim sr As StreamReader = File.OpenText(ReportFile.Text)
Do Until sr.Peek = -1
Dim bufferChar(0) As Char
sr.Read(bufferChar, 0, bufferChar.Length)
FileData &= bufferChar(0).ToString
Loop
sr.Close()
But the FileData.Length only ends up being ~68,000 bytes long. Whereas the
file is learly ~104,000 bytes.
Please -- ANYONE! Help me!
Thanks!
Jason Roozee
conclustion. I have a crystal report file which is obviously not a text
file, it's a binary file. I want to open the file and store every single
byte of it's data in to a string variable. In my attempts using a
BinaryReader object, I've had no success. I either only get some of the data
or I get a error when PEEKing the data "Index was outside the bounds of the
array".
I have the book "Programming Microsoft Visual Basic .NET" by Microsoft as
my guide to my transision from VB6 to .NET.
In VB6 I would typically use the following code:
Dim strFileData as string
Open fileName for binary access read as #1
strFileData = string$(lof(1), 0)
get #1, , strFileData
Close #1
However, In .NET, it seems impossible. I have attached the file I am trying
to store in to a string so that anyone who would like to try to help me can
have a look at the data I am trying to store. No one seems to be able to
have an answer!
I've tried this in .NET:
Dim sr As StreamReader = File.OpenText(ReportFile.Text)
Do Until sr.Peek = -1
Dim bufferChar(0) As Char
sr.Read(bufferChar, 0, bufferChar.Length)
FileData &= bufferChar(0).ToString
Loop
sr.Close()
But the FileData.Length only ends up being ~68,000 bytes long. Whereas the
file is learly ~104,000 bytes.
Please -- ANYONE! Help me!
Thanks!
Jason Roozee