When I'm browsing the DGV that when he hit enter change column.
Have searched the net but the examples I found did not work, if you guys can help me.
I thank you.
I've tried, but it's not what I need
If e.KeyCode = Keys.Enter Then
SendKeys.Send (Keys.Tab)
end If
I've tried another one below it worked, but when I use a button to enter it works like tab, or form is turned in, I want to just stay active in
DataGridView
.
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
If (Me.DataGridView1.Focused OrElse Me.DataGridView1.EditMode) AndAlso keyData = Keys.Enter Then
SendKeys.Send("{TAB}")
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
is not what I need.
need that every time I press enter, it will enter that cell to cell and the column next to the finish line, not down.
I found this on the internet, it was almost but still not what I need.
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
If keyData = Keys.Enter Then
If TypeOf Me.ActiveControl Is DataGridViewTextBoxEditingControl OrElse _
TypeOf Me.ActiveControl Is DataGridViewComboBoxEditingControl Then
If dgv1.CurrentCell.ColumnIndex < dgv1.ColumnCount - 1 Then
dgv1.CurrentCell = dgv1.Rows(dgv1.CurrentCell.RowIndex).Cells(dgv1.CurrentCell.ColumnIndex + 1)
Else
Return MyBase.ProcessCmdKey(msg, keyData)
End If
End If
Else
Return MyBase.ProcessCmdKey(msg, keyData)
End If
End Function
event datagrid
Private Sub DataGridView_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView.CellEnter
If e.ColumnIndex = 1 Then
dgv1.BeginEdit(True)
End If
End Sub