Page 1 of 1

VB.NET: Imageviewer Image from stream(from DB)

Posted: Mon Dec 17, 2012 2:35 pm
by communi
I have a datagridview displaying in one of the columns images(from a database). Now I'm trying to display this image from the selected row in the ImageViewer component, but this doesn't work like with a normal picturebox :(
With this code displaying the image in a normal picturebox works perfectly:

Code: Select all

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim pictureData As Byte() = DataGridView1.SelectedCells.Item((DataGridView1.Columns.Count) - 1).Value
        Dim picture As Image = Nothing
        PBDB.Image = Nothing
        Using stream As New IO.MemoryStream(pictureData)
            picture = Image.FromStream(stream)
        End Using
        'ImageViewer1.Image = picture
        pbDB.Image = picture
End Sub
When I try to do this with the ImageViewer there comes an error from IntelliSense: "System.Drawing.Image cannot converted to Vintasoft.Imaging.VintasoftImage"
How can I realize, that the cell content containing the Image as bytes will displayed in the ImageViewer?

Thank you!

Re: VB.NET: Imageviewer Image from stream(from DB)

Posted: Tue Dec 18, 2012 9:13 am
by Alex

What code do you use when you work with the ImageViewer ?

You need to use code like this:

Code: Select all

ImageViewer1.Image = New VintasoftImage(bitmap, False)
Please read information about constructors of the VintasoftImage class in the on-line documentation here:

Best regards, Alexander