Link to home
Start Free TrialLog in
Avatar of rp
rpFlag for Portugal

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

Open in new window

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

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.
Avatar of rp

ASKER

To save in database and retrieve to a picturebox.
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
:)