-3

(dgv_configCH is a winform DataGridView). As you can see in the picture below, the VS executor is within the if's brackets with a false condition. Actually, the VS executor doesn't enter after checking the condition, but just before leaving the function. In this program, my purpose is simply being able to use the DataGridViewCheckBoxCell because dgv_configCH[e.ColumnIndex, e.RowIndex].Value.ToString() always returns true in the dgv_configCH_CellValueChanged event.

enter image description here

Roshan
  • 905
  • 9
  • 21
MHamdaoui
  • 1
  • 1
  • 2
    Is it possible to become false after CommitEdit()? – Indrit Kello Aug 25 '17 at 14:23
  • 1
    @IndritKello Committing is exactly what makes the cell "clean" again ... so I'd say perfectly expected image. – Fildor Aug 25 '17 at 14:24
  • I screen recorded what's happening: https://www.youtube.com/watch?v=HIevvCGDV48 For more clarification I press F11 too fast but what it does is : just before leaving the function, after the ending bracket it goes back to the line dgv_configCH.CommitEdit... – MHamdaoui Aug 25 '17 at 14:50

1 Answers1

0

Well it was true, when the compiler hit the line - for sure ;) Please change to

var isDirty = this.dgv_configCH.IsCurrentCellDirty; if (isDirty)

you will see, you changed state with commitedit() and so you cannot see the correct if condition anymore in the line you stopped.

Tom Söhne
  • 512
  • 2
  • 6
  • it looks to me like you hit the method twice - first time it exits with isDirty false and second it lands in the condition - right? if so is it the same thread? if not you can try to synchronize the calls in the Method. – Tom Söhne Aug 31 '17 at 07:16