jpadkins49
asked on
Convert Binary String to Image
All,
I have a binary string that is an image in stored in a database. I am at a loss on how to convert this binary string to an image and display in an item such as picturebox using Vb.net
Thanks
I have a binary string that is an image in stored in a database. I am at a loss on how to convert this binary string to an image and display in an item such as picturebox using Vb.net
Thanks
Or
Dim str as New MemoryStream(bytearray)
Picturebox1.Image = Image.FromStream(str)
Dim str as New MemoryStream(bytearray)
Picturebox1.Image = Image.FromStream(str)
ASKER
Here is what I have written in the meantime, but I get an error on the second line stating 'Value of type system.data.linq.binary' cannot be converted to 1-dimensional array.
Any help is greatly appreciated.
Any help is greatly appreciated.
Dim Inspections = Context.InspectionSignatures.Single(Function(p) p.ID_PKEY = 36)
Dim barrImg As Byte() = CType(Inspections.FirmRepSignature, Byte())
Dim strfn As String = Convert.ToString(DateTime.Now.ToFileTime())
Dim fs As New FileStream(strfn, FileMode.CreateNew, FileAccess.Write)
fs.Write(barrImg, 0, barrImg.Length)
fs.Flush()
fs.Close()
PictureBox1.Image = Image.FromFile(strfn)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help. That fixed the problem. I had a temporary lapse in memory and could not figure it out.
Glad to help :-)
IO.File.WriteAllBytes("pat
Then
Picturebox1.Image = Image.FromFile("path of file")