Dear Experts
Is there an easy way to move into datagridview columns with ENTER key instead of TAB key.
In other words: how to move in next column with enter key?
Please help
Dear Experts
Is there an easy way to move into datagridview columns with ENTER key instead of TAB key.
In other words: how to move in next column with enter key?
Please help
>how to move in next column with enter key?
Handle the KeyDown event.
Private Sub DataGridView1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
If e.KeyCode = Keys.Enter Then
Dim numCols As Integer = DataGridView1.ColumnCount
Dim numRows As Integer = DataGridView1.RowCount
Dim currCell As DataGridViewCell = DataGridView1.CurrentCell
If currCell.ColumnIndex = numCols - 1 Then
If currCell.RowIndex < numRows - 1 Then
DataGridView1.CurrentCell = DataGridView1.Item(0, currCell.RowIndex + 1)
End If
Else
DataGridView1.CurrentCell = DataGridView1.Item(currCell.ColumnIndex + 1, currCell.RowIndex)
End If
e.Handled = True
End If
End Sub