How to run Run CellEndEdit only when Cell ValueChanged in DataGridView

后端 未结 5 1313
囚心锁ツ
囚心锁ツ 2021-01-13 04:45

i want to run CellEndEdit only when value of cell is changed, tried putting

if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == e.For         


        
5条回答
  •  深忆病人
    2021-01-13 05:01

    You could definitely get there by catching the current cell value in CellBeginEdit, then comparing it to the current cell value in CellEndEdit. (Or use your CellValidation trick.)

    To avoid "multiple flags", you could use a Dictionary so you can key into the dictionary with the current event's grid, then get or set the appropriate value.

提交回复
热议问题