For i As Integer = 0 To DG.Rows.Count - 2
If i <> e.RowIndex Then
If DG("col_id", e.RowIndex).Value = DG("col_id", i).Value Then
MsgBox("duplicate")
e.Cancel = True
DG("col_id", e.RowIndex).ErrorText = "not duplicate"
DG.CurrentCell = DG.CurrentRow.Cells(0)
DG.EndEdit()
Exit For
Else
e.Cancel = False
DG("col_id", e.RowIndex).ErrorText = ""
End If
End If
Next i