tried it , didnt work.
after i hit ok on the message box, the keyboard cursor goes on the next column of the last row.
here's my code
Private Function CheckItemInGrid(ByVal Item As String) As Boolean
Dim CheckValue As String
For i As Integer = 0 To (grdInvoice.Rows.Count) – 2
CheckValue = grdInvoice.Rows(i).Cells(0).Value.ToString
If CheckValue = Item Then
grdInvoice.Rows(i).Cells(0).Selected = True
MsgBox("Item Already Exists")
'grdInvoice.ActiveRow.Delete(False)
grdInvoice.ActiveRow = grdInvoice.Rows(i)
grdInvoice.ActiveCell = grdInvoice.ActiveRow.Cells(0)
'grdInvoice.PerformAction(EnterEditMode, False, False)
Return True
Exit For
Exit Function
End If
Next
Return False
End Function