Hi all,
I'm trying to save a picturebox image to a database. This is part of the
code I'm using:-
<snip>
Private drv As DataRowView
Private dr As MainDataSet.OrdersRow
If PictureBox.Image IsNot Nothing Then
dr.Pic = CreateByteImage()
End If
<snip>
Private Function CreateByteImage() As Byte()
Dim ms As New IO.MemoryStream
PictureBox.Image.Save(ms, PictureBox.Image.RawFormat)
Dim arrImage() As Byte = ms.GetBuffer
ms.Close()
Return arrImage
End Function
The problem is it fails on the PictureBox.Image.Save line with the error -
Value cannot be null.
Parameter name: encoder
As far as I can tell I'm not passing a NULL reference, can anyone tell me
where I might be going wrong?
Thanks and kind regards,
Martin Horn