I have a WinForm in C#. One of the column of the DataGridView
is of type DataGridViewLinkColumn
. How do I handle the click event on each column ?>
Why don't you use CellClick
event handler, you can refer to corresponding column of each row, e.RowIndex
by using e.ColumnIndex
, as shown below:
private void dataGridView1_CellClick(object sender,
DataGridViewCellEventArgs e)
{
// here you can have column reference by using e.ColumnIndex
DataGridViewImageCell cell = (DataGridViewImageCell)
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
// ... do something ...
}