Reputation: 9
I have dataGridView
and CellDoubleClick
event.
I need to do some actions when cell is clicked two times but it must be cell in a column with a specific name. I don't have any idea how to check column name.
P.S. dataGridView
must have SelectionMode = FullRowSelect
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if ( /*check column name*/ )
{
// actions
}
}
Upvotes: 0
Views: 2074
Reputation: 1099
You can get it from the event
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
string columnName = this.dataGridViewName.Columns[e.ColumnIndex].Name;
if ( columnName )
{
// actions
}
}
you can get the index with
int columnIndex = dGVTransGrid.CurrentCell.ColumnIndex;
Upvotes: 4