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

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)

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.