rp
asked on
Image byte array
In the code below to load an image to a datarow i would like to understand why i need create a memory stream and then convert to byte array.
Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream
PicLogotipo.Image.Save(ms, PicLogo.Image.RawFormat)
datarow1("Logo") = ms.ToArray
what are you doing with the datarow/table? I have seen situation where it was the only way to provide image. My scenario was with Crystal Reports.
ASKER
To save in database and retrieve to a picturebox.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Internals:)
ReadAllBytes is implemented in an obvious way. It uses the using-statement on a FileStream. Then it loops through the file and puts the bytes into an array.