title: Navigating through datagridview cells with enter key
body: <p>I've tried several combinations but didn't have any success. When button is pressed focus is on yellow (1), I would like  when enter key is pressed, that focus goes to cell (2), then (3) and so on.</p>
  
  <p><img src="https://i.stack.imgur.com/OugJX.png" alt="enter image description here"></p>
  
  <p>If there are no cell edits, with just enter key everything is fine with this code :</p>
  
  <pre><code> Private Sub DGVBU1_KeyDown(sender As Object, e As KeyEventArgs) Handles DGVBU1.KeyDown
          If e.KeyCode = Keys.Enter Then
              Dim CLIndex As Integer = DGVBU1.CurrentCell.ColumnIndex
              Dim RWIndex As Integer = DGVBU1.CurrentCell.RowIndex
              If CLIndex = 2 Then
                  DGVBU1.CurrentCell = DGVBU1.Rows(RWIndex - 1).Cells(CLIndex + 1)
              ElseIf CLIndex = 3 Then
                  DGVBU1.CurrentCell = DGVBU1.Rows(RWIndex).Cells(CLIndex - 1)
              End If
          End If
      End Sub
  </code></pre>
  
  <p>But when Enter key is pressed after cell edit it goes down to row+1.</p>
  
  <p>I've also tried this : </p>
  
  <pre><code>Private Sub DGVBU1_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles DGVBU1.CellEndEdit
      Dim CLIndex As Integer = DGVBU1.CurrentCell.ColumnIndex
      Dim RWIndex As Integer = DGVBU1.CurrentCell.RowIndex
      If CLIndex = 2 Then
          DGVBU1.CurrentCell = DGVBU1.Rows(RWIndex).Cells(CLIndex - 1)
          DGVBU1.CurrentCell = DGVBU1.Rows(8).Cells(CLIndex + 1)
      ElseIf CLIndex = 3 Then
          DGVBU1.CurrentCell = DGVBU1.Rows(RWIndex).Cells(CLIndex - 1)
      End If
  End Sub
  </code></pre>
  
  <p>...but then enter key send focus from (1) directly to cell (4). </p>
  
  <p>Is it possible to make this work?</p>
  
  <p>Thanks for any help.</p>