Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help converting types

Status
Not open for further replies.

pink2070

Programmer
Jan 29, 2004
23
US
I am trying to give the value of filestream:
stream

To an array of bytes:
buffer

Can someone give me the correct syntax for assigning a filestream to a 1-dimensional array of byte?

I am receiving the following errors:
Value of type 'long' cannot be converted to a '1-dimensional array of byte'

'Create a stream to load the file
Dim stream As FileStream = New FileStream("\\DirectoryName1\DirectoryName2\DirectoryName3\fileName.pdf", FileMode.Open, FileAccess.Read)
'Create a buffer to hold the information
'Dim buffer() As Byte = CType(stream.Length, Byte())

Please help!

Thanks Pink
 
shouldn't that be

Code:
Dim buffer() As Byte = CType(stream, Byte())

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top