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
How can I realize, that the cell content containing the Image as bytes will displayed in the ImageViewer?
Thank you!