Hi
I have a datagridview with ONE column.
I enter my value in each row.
Each time I finish entering the value I check the value to make sure if was not entered. So far I have managed to get this part working this way:

Code:
 Private Sub DataGridView1_CellEndEdit(....
If My.Settings.myCollection1.IndexOf(MyDataGridView1.CurrentCell.Value) = -1 Then
            
        Else

            MsgBox(MyDataGridView1.CurrentCell.Value & " is duplicate")
end if
myCollection1 is just a dictionay with values I want to compare too.

So far everything works. It does tell me that the value is a duplicate.

What I want to do is to keep the user on the same row, and delete whatever was entered.


I tried MyDataGridView1.CancelEdit

But it does not seem to work,

what am i doing wrong ?

thanks !