Reputation: 694
This is the first time I ask a question, I'll try to be clear. I created a datagridview in vb.net which contains 3 columns and 5 rows. My columns contains job headers. Each row contain information about these jobs : the firstname, lastname, society, phone number, mail.
It looks like :
| J1 | J2 | J3
----------------------------
firstname | x | y | z
lastname | x1 | y1 | z1
society | x2 | y2 | z2
phone number | x3 | y3 | z3
mail | x4 | y4 | z4
When i edit the firstname of the job 1 (x), i would like to enter to the lastname's cell of this job (x1) by pressing tab. Currently, when i press tab, i enter in the firstname's cell of the second job (y).
I tried to change the currentcell after the datagridview.CellEndEdit event. I noticed that the cell (x1) is selected, but the tab key change my edited currentcell to the 'ordinary currentcell' (y).
How can i prevent the tab key to change my edited currentcell ? Thanks.
Upvotes: 1
Views: 498
Reputation: 81610
Try creating your own DataGridView control so you can override the ProcessCmdKey operation:
Public Class DataGridViewEx
Inherits DataGridView
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean
If keyData = Keys.Tab Then
Me.ProcessDownKey(keyData)
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
End Class
Upvotes: 0