0

I use visual baisc 2008
if i use "mouse click" or "use arrow keys " in the datagridview1 then i want that always the focus in on the textfield => Number_Pieces.text

Is use this code :

Private Sub Datagridview1_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles Datagridview1.CellMouseClick
               Number_Pieces.Focus()   
 End Sub

But now the datagridview1 no longer responds the arrows keys (Up and Down)

Private Sub Datagridview1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Datagridview1.KeyDown

   Select Case e.KeyCode
            Case Keys.Down
                ..................
               e.Handled = True
            Case Keys.Up
               .................
              e.Handled = True
  End Select

End Sub

Who can help with this problem?

Regards,

Andre

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dre-logics
0

Hi,

If you know the cell, like having a reference to it from the variable desiredCell you can simply do the following:

dataGridView1.CurrentCell = desiredCell
dataGridView1.BeginEdit(True)
0

I don't now the cell, but i now the row with the user move the cursor to (with mouse or use the arrow key)
In which "event" need your code to by?

Edited by dre-logics: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.