Note that there are some explanatory texts on larger screens.

plurals
  1. PODataGridView Events
    primarykey
    data
    text
    <p>I need to perform a task whenever the user ordinarily ends edit mode (no matter if the user actually modified the value or not; but not when the user cancels edit mode by pressing ESC) in a TextBox column of a <code>DataGridView</code> control.</p> <p>I tried several events of the <code>DataGridView</code> control itself and also of the editing control, but none of them does exactly what I want:</p> <p><strong><code>DataGridView.CellValidating</code> and <code>DataGridView.CellValidated</code>:</strong></p> <p>These events are fired whenever the user selects another cell, even if the cell was not in edit mode. I tried to check the <code>IsCurrentCellDirty</code> property inside the <code>CellValidating</code> event. This is almost what I need but <code>IsCurrentCellDirty</code> is only set when the user actually changes the value. But I also need to perform the task when the user ordinarily ends edit mode without having changed anything. These events are not fired when the user cancels edit mode, which is good.</p> <p><strong><code>DataGridView.CellValueChanged</code></strong></p> <p>This event is also fired too often (it is also fired when the value of a cell is set programmatically).</p> <p><strong><code>DataGridView.CellEndEdit</code></strong></p> <p>This event is almost what I want. But it is also fired when the user cancels edit mode by pressing ESC. Is there a way to check if edit mode was cancelled inside the <code>CellEndEdit</code> event?</p> <p><strong><code>DataGridView.CellParsing</code></strong></p> <p>This event is almost what I want. But it is not fired when the user ends edit mode without having changed anything.</p> <p><strong><code>Validating</code> and <code>Validated</code> events of the editing control</strong></p> <p>I registered to these events inside the <code>DataGridView.EditingControlShowing</code> event. They do almost what I want but they are also fired when the user cancels edit mode by pressing ESC. Is there a way to check if edit mode was cancelled inside the these events?</p> <p><strong>Any other suggestions for events I could register to and/or flags I could check to achieve the desired behaviour?</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload