I've got a DataGridView that is bound to a DataTable. There are only 2 columns. Currently, I'm allowing the user to enter/edit data directly with the DataGridView. What I'm having trouble implementing is a validation sequence.

Both columns MUST have data - neither can be blank. In addition, one column has a maximum of 2 characters. Here's what I would like:

Every time a cell is edited or a row added, I would like the code to verify that all the data in the row is valid. If it is NOT valid, I would like the program to automatically highlight the offending row, and make the offending cell active.

The validation code is very simple and works fine. The problem I've run into is making the offending cell active if validation fails. Since validation requires the exiting of the cell/row, the active cell always becomes the cell that the user moved into after making changes.

Here's my validation code: (I am calling it on DataGridView.RowValidating, DataGridView.RowLeave, and DataGridView.CellEndEdit)
Code:
Private Sub ValidateCellData(RowIndex As Integer, ColumnIndex As Integer)

        Select Case dgv.Rows(RowIndex).Cells(ColumnIndex).Value.ToString.Length

            Case Is = 0
                MessageBox.Show("Values are missing. Please re-enter.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                dgv.ClearSelection()
                dgv.Rows(RowIndex).Selected = True
                dgv.CurrentCell = dgv.Rows(RowIndex).Cells(ColumnIndex)
                dgv.FirstDisplayedScrollingRowIndex = RowIndex

        End Select

End Sub
Any thoughts would be much appreciated. Thanks!