Search code examples
c#databasevalidationdatagridviewcell

How to get grid cell value before update


What is the best way to get datagridviw cell value just before update of that cell? On every update of certain column cell in datagridview, I need to make some changes in database, based on values before and after update. What is the best way to do it? Thanks!


Solution

  • What about CellEndEdit event ?

    private void yourGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
     {
    
        string value = yourGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
      }