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:
  1. If MyDataGridView.Rows(e.RowIndex) IsNot Nothing AndAlso Not MyDataGridView.Rows(e.RowIndex).IsNewRow Then
  2. '...code..
  3. End If