Using the RowValidating events works fine.
But if i click somewhere in the datagridview without changing the row the event is always fireed after selecting another contorl.
Sample-1 (correct):
Selecting a Row -> Selecting a Textbox -> Selecting antoher Row
|->RowValidating raised
Sample-2 (incorrect):
Selecting a Row -> Clicking the Columnheader -> Selecting a Textbox -> Selecting antoher Row
|->RowValidating raised |->RowValidating raised
Sample-3 (incorrect):
Selecting a Row -> Clicking empty Area -> Selecting a Textbox -> Selecting antoher Row
|->RowValidating raised |->RowValidating raised
Is there any way to only get RowInvalidating before a row is realy changeing?
I already tried to override SetSelectedRowCore and was able the cancel the selection change, but the datagridview sends EndEdit() to the Binding before SetSelectedRowCore is fired.
I’ve found a little dirty workaround:
First I get the Current mouse position in DataGridView.
Afterward I check if a cell if clicked. (False -> Finished)
At least I check if the clicked cell/row is not the current (False -> Finished | True -> Validate)