Comparing Datagrid cell original value with edited value in CellEditEnding event <p>I have a totals variable that is updated based on the numbers entered by the user in my Datagrid rows. I would like to update that value on changing each row cell. This is what I've done so far:</p> <pre><code>private void QuotationDG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { int ColumnIndex = e.Column.DisplayIndex; Double amount= Double.Parse(((TextBox)e.EditingElement).Text); Cat1SubTotal += amount; GrandTotal += amount; } </code></pre> <p>This code adds up the amount each time the user enters a new value. However, if the user edited the existing value then this would add up the new value without removing the old value thus will show incorrect totals.</p> <p>I need to do something like this:</p> <pre><code>Cat1SubTotal += (NewValue-OriginalValue) </code></pre>