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
Open the image while click on the filename in datagridview
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mohammad Kanderi2 reputationPosted Jul 24, 2012, 4:13 AM EDT
Try this code
Dorababu MekaRank #457 · 5.5K reputationPosted Jul 24, 2012, 4:22 AM EDT
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 ;
}