Hi Friends,
In windows application I want to open the file while click the file name in gatagridview cell.
DataGridView (database)having 4 fields
1) Image_Name
2) Project_Name
3) Received_Date
4) Image_Path
when i click or press the down arrow on the datagridview the respective image should be open in picturebox according to image_path (i have populated the image location and saved in 4th column).
Could you please anybody help me here
Regards,
Gopi A
Loading
Dorababu MekaPosted Jul 24, 2012, 8:22 AM
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
DataGridViewImageCell img = new DataGridViewImageCell();
img = dataGridView1 .Item("ImageColumn", e.RowIndex);
PictureBox1.Image = byteArrayToImage(img.Value);
}
static private Image byteArrayToImage(byte[] byteImg)
{
MemoryStream ms= new MemoryStream();
Image imgcol= null;
try
{
ms.Write( byteImg ,0, byteImg .Length);
imgcol = new Bitmap(ms);
}
finally
{
ms.Close();
}
return imgcol ;
}
Mohammad KanderiPosted Jul 24, 2012, 8:13 AM
Try this code