Convert image to byte

  • Thread starter Thread starter su see
  • Start date Start date
S

su see

While dr.Read

form = dr("form")

Dim img As Image
Dim b() As Byte
b = form
If b.Length > 0 Then
Dim stream As New MemoryStream(b, True)
stream.Write(b, 0, b.Length)
* img = New Bitmap(stream)
stream.Close()
End If
End While

Now, I want to retrieve the form and displayed into the picturebox form
(form is one of my attributes in a table and its datatype is varbinary).
The form was inserted as a byte into the database. I have problem with
the above code. Does anyone know why? Thank you.

The below error occured at * statement.
An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Invalid parameter used.


:)
 
Back
Top