I am having some trouble with reading a memory stream in chunks.
Dim ByteBuffer(4096) As Byte
While ProcessedBytes < FileLength
BytesRead = MemoryStream.Read(ByteBuffer, 0, 4096)
'Write the buffer to an output stream
ProcessedBytes += BytesRead
End While
'MemoryStream.Read(ByteBuffer, 0, 4096)' is always returning zero. I have looked at 'MemoryStream.Length' and the stream definitely has some bytes in it.