Settting select cell value from a datagridview

I have the following code.  What I am trying to do is after a cell value has changed from one of these 3 columns, I want to validate data.  If it comes back false I want to go back to the cell that just failed validation.  I have the following code and the validation works, however I cant seem to get it to go back to the unvalidated cell.

thanks in advance

Here is the code

 Private Sub dgv1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv1.CellValueChanged
        Dim myError As String = ""
        If isLoading Then
            If e.ColumnIndex = 5 Then
            ElseIf e.ColumnIndex = 6 Then

                If ValidateColumn(dgv1(e.ColumnIndex, e.RowIndex).Value.ToString, e.ColumnIndex, myError) Then
                    dgv1.CurrentCell = dgv1.Rows(e.RowIndex).Cells(e.ColumnIndex)
                    'dgv1.Rows(e.RowIndex).Cells(e.ColumnIndex).Selected = True
                    Exit Sub
                End If

            ElseIf e.ColumnIndex = 8 Then
            End If
        End If

    End Sub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.