b001
asked on
Datagridview move cursor to right
Hi
I am trying to move the cursor to right in the grid when ENTER key is pressed.
My Code
Private Sub DataGridParts_KeyDown(send er As Object, e As KeyEventArgs) Handles DataGridParts.KeyDown
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
Dim iCol = DataGridParts.CurrentCell. ColumnInde x
Dim iRow = DataGridParts.CurrentCell. RowIndex
If iCol = 9 Then
DataGridParts.CurrentCell = DataGridParts(0, iRow + 1)
Else
DataGridParts.CurrentCell = DataGridParts(iCol+1, iRow)
End If
end if
end sub
It works fine as long as you don not change any cell value.
If I change the cell text and then when ENTER key pressed it goes down to next row instead going to right in the sale row.
Please help
I am trying to move the cursor to right in the grid when ENTER key is pressed.
My Code
Private Sub DataGridParts_KeyDown(send
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
Dim iCol = DataGridParts.CurrentCell.
Dim iRow = DataGridParts.CurrentCell.
If iCol = 9 Then
DataGridParts.CurrentCell = DataGridParts(0, iRow + 1)
Else
DataGridParts.CurrentCell = DataGridParts(iCol+1, iRow)
End If
end if
end sub
It works fine as long as you don not change any cell value.
If I change the cell text and then when ENTER key pressed it goes down to next row instead going to right in the sale row.
Please help
ASKER
Hi losisfr
please convert the above code for VB Basic
Thanks
please convert the above code for VB Basic
Thanks
ASKER
I mean Visual Studio Basic
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window