J
JamesBuss
Guest
I have an Access database. The "Poster" field stores a picture. I want to be able to read that picture and use it in an Image. I have tried the following code:
Dim Poster As PictureBox = Nothing
If Not IsDBNull(Me.DataTableBindingSource(x)("Poster")) Then
Dim bytBLOBData() As Byte = Me.DataTableBindingSource(x)("Poster")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
stmBLOBData.Write(bytBLOBData, 0, bytBLOBData.Length)
Poster.Image = Image.FromStream(stmBLOBData)
End If
When I run the code I get a NullReference exception on the last line before the End If. What am I doing wrong?
Continue reading...
Dim Poster As PictureBox = Nothing
If Not IsDBNull(Me.DataTableBindingSource(x)("Poster")) Then
Dim bytBLOBData() As Byte = Me.DataTableBindingSource(x)("Poster")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
stmBLOBData.Write(bytBLOBData, 0, bytBLOBData.Length)
Poster.Image = Image.FromStream(stmBLOBData)
End If
When I run the code I get a NullReference exception on the last line before the End If. What am I doing wrong?
Continue reading...