[RESOLVED] DataGridView and RowValidating and Escape Delete Error
Hi
I have a bounded datagridview and have some code in row validating event. When i add a new line by writing something in one of the cells of the new row, and if in the middle of the process i wish to cancel this new row, if i use the escape key i get an exception, something like, Index (number of the removed row) does not have a value. After the exception the exception the row it's removed...
How can i make the row validating to work correctly?
I have this code in the start of rowValidating
vb.net Code:
If MyDataGridView.Rows(e.RowIndex) IsNot Nothing AndAlso Not MyDataGridView.Rows(e.RowIndex).IsNewRow Then
'...code..
End If
Re: DataGridView and RowValidating and Escape Delete Error
Re: DataGridView and RowValidating and Escape Delete Error
Have you checked e.Cancel in RowValidating
Re: DataGridView and RowValidating and Escape Delete Error
Hehehe
Sure I checked, that's the main property of the row validating... :)
Solved the problem, just added another property to the IF statement, the IsCurrentRowDirty...
MSDN Info
Thanks