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

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
communi
Posts: 12
Joined: Wed Jul 13, 2011 11:07 pm

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

Post by communi » Mon Dec 17, 2012 2:35 pm

Hello,
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!

Alex
Site Admin
Posts: 1443
Joined: Thu Jul 10, 2008 2:21 pm

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

Post by Alex » Tue Dec 18, 2012 9:13 am

Hello,

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:
http://www.vintasoft.com/docs/vsimaging-dotnet/

Best regards, Alexander

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest