> I want to use a byte array to store all the content of a file. Is there
anyway allow me to do so?
read the contents of a file into a byte array like this:
Dim Filespec as string = "..." ' your file name goes here
Dim fs As IO.FileStream = Nothing
Dim Buffer() As Byte = Nothing
Try
fs = New IO.FileStream(Filespec, IO.FileMode.Open)
ReDim Buffer(CInt(fs.Length))
fs.Read(Buffer, 0, Buffer.Length)
Catch ex As Exception
' whatever you want goes here
Finally
If Not fs Is Nothing Then fs.Close()
End Try
' Buffer() contains the file or your Catch code has done something helpful