UPDATE:
I have been playing around with all day and I am getting really close...
The below is what I have implemented, but I have discovered I am still able to populate a row without an Employee or Code if a use the Tab key
Private Sub gv_Data_ValueChanging(sender As Object, e As ValueChangingEventArgs) Handles gv_Data.ValueChanging
If gv_Data.CurrentColumn.Name = "EmployeeID" Then
Dim currentValue = e.NewValue
For Each item In gv_Data.Rows
If item Is gv_Data.CurrentRow Then
Continue For
End If
If String.IsNullOrEmpty(item.Cells("EmployeeID").Value.ToString) = False Then
If DirectCast(currentValue, Guid) = DirectCast(item.Cells("EmployeeID").Value, Guid) Then
e.Cancel = True
MessageBox.Show("Cannot duplicate employee on the Job Crew")
Exit For
End If
End If
Next item
End If
End Sub
Private Sub gv_Data_RowValidating(sender As Object, e As RowValidatingEventArgs) Handles gv_Data.RowValidating
' CLEAR ANY CURRENT GUI INDICATION OF ROW ERROR
e.Row.ErrorText = String.Empty
' STOP VALIDATION IF THE ESCAPE KEY WAS PRESSED
If quitValidating = True Then
quitValidating = False
Return
End If
' PERFORM THE VALIDATIONS
If e.Row IsNot Nothing AndAlso e.Row.Cells(1).Value Is Nothing Then
e.Row.ErrorText = "Employee selection is required"
e.Cancel = True
End If
If e.Row IsNot Nothing AndAlso e.Row.Cells(2).Value Is Nothing Then
e.Row.ErrorText = "Pay Code is required"
e.Cancel = True
End If
End Sub
Private Sub gv_Data_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles gv_Data.PreviewKeyDown
' CONTROL THE ROW VALDATION
If e.KeyData = Keys.Escape Then
quitValidating = True
End If
End Sub
So again, what am I missing?