This is my code for pressing Enter Key and moving to the next cell:
Private Sub dvFromAlloc_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dvFromAlloc.CellEndEdit
SendKeys.Send("{up}")
SendKeys.Send("{right}")
End Sub
Private Sub dvFromAlloc_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dvFromAlloc.KeyDown
If e.KeyCode = Keys.Enter Then
SendKeys.Send("{up}")
SendKeys.Send("{right}")
End If
End Sub
This is perfectly working, now what I want is if the user is in the last column, how can I move the cell to the first column of the second row?
Thank you.
You may try this in your KeyDown
event ..
Private Sub dvFromAlloc_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dvFromAlloc.KeyDown
If e.KeyCode = Keys.Enter Then
dvFromAlloc.CurrentCell = dvFromAlloc.Rows(dvFromAlloc.CurrentCell.RowIndex + 1).Cells(0)
dtg.Rows(i).Cells(aColumn(x))
End If
End Sub