1

I have a DatagridView that are populated manually (no Bind). Have 3 columns: Value 1 Value 2 And Value 3

The user can edit value 1 and value 2 columns. After the user edit the value 1 or value 2 i need to do something:

if((Value 1 + Value 2) > Value 3) The row color change to red

else the row color change to green

Question:

What event should i use to capture the user input? I tried CellValueChanged, CellValidatin and CellEndEdit, but some events are triggered when the grid its populated, and other are triggered if the user do a simple click on the grid... I need to do something only when the user end edit a cell (value 1 or value 2) manually

Thanks a lot

enter image description here

Nonick
  • 43
  • 5
  • Why won’t the grids `CellEndEdit` event work for you? It will fire when the user tries to leave a cell that was in edit mode. – JohnG Jan 09 '22 at 22:06
  • To act upon a value change immediately, see the use of `CellEndEdit` + `Validate()` here: [Correct event to calculate Cells values in a DataGridView](https://stackoverflow.com/a/62291110/7444103) (last section), or here: [Programmatically check a DataGridView CheckBox that was just unchecked](https://stackoverflow.com/a/62031996/7444103) (you don't need `RefreshEdit()` here, just `EndEdit()` most probably; see the method used to update the values immediately, without changing Cell) – Jimi Jan 10 '22 at 03:36

0 Answers0