-3

I want to store on a variable the value of the first column of a row whenever I click on a cell.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

1

You can try this code :

private void MyDataGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{
    var val = MyDataGrid.Rows[e.RowIndex].Cells[0].Value;
}

Hope this help you.

Francois Borgies
  • 2,378
  • 31
  • 38