Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Retrieve an Image from an Access database

$
0
0

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?


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>