I tried to implement an example of what I think you are asking about. It's a windows form with one DataGridView and one PictureBox. There is no data binding here. The dataGridView1 control has three columns for Name, a cellbutton, and an image. I think what you are seeking is a way to add an event to pick the image out of the data grid. I chose the CellContentDoubleClick event that you can find in the Design view by clicking the data grid and clicking on the lightening bolt symbol at the top of the property pane for the control. If you double click then on the CellContentDoubleClick event, VS will stub a handler for you. Here is what I coded:
namespace PicturePickerForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dataGridView1.Rows[0].Cells[1].Value = new DataGridViewButtonCell();
}
private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e)
{
dataGridView1.Rows[dataGridView1.RowCount -1].Cells[1].Value = new DataGridViewButtonCell();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.CurrentCellAddress.X != 1)
return;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Bitmap pic = new Bitmap(openFileDialog1.FileName);
dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[2].Value = pic;
}
}
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.CurrentCellAddress.X == 2)
pictureBox1.Image = (Image)dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[2].Value;
}
}
}