I m using this code to Put image from Datagridviewimage column to Picturebox
end sub
I want to know how can I Put PictureBox =Nothing if DatagridviewimageCoulumn is null i.e (has not picture)
Thx.
VB.NET:
Private Sub Dgv1_CellDoubleClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Dgv1.CellDoubleClick
try
Dim pCell As New DataGridViewImageCell
pCell = Me.Dgv1.Item("PictureDataGridViewImageColumn", e.RowIndex)
Me.ProductPicture.Image = byteArrayToImage(pCell.Value)
Catch ex As Exception
MessageBox.Show("Error :" & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Private Function byteArrayToImage(ByVal byt As Byte()) As Image
Dim ms As New System.IO.MemoryStream()
Dim drwimg As Image = Nothing
Try
ms.Write(byt, 0, byt.Length)
drwimg = New Bitmap(ms)
Finally
ms.Close()
End Try
Return drwimg
Conn.Close()
End Function
I want to know how can I Put PictureBox =Nothing if DatagridviewimageCoulumn is null i.e (has not picture)
Thx.