DataGridView focus to the Next Cell or Column when Enter key is Pressed

n70n1

Member
Joined
Oct 1, 2012
Messages
8
Programming Experience
3-5
Hi all master here, I am using DataGridView in VB.Net 2010, I want when press Enter key, the focus go to the next cell (desired cell of the same row). And when reach the last column in the datagridview then the focus go to the first column of the next row. May be someone can give me sample code. Thanks
 
Are you aware that there is a standard keyboard key that already fills this behaviour, the TAB key?
 
Maybe it is better they change their habit according to computer standards? Though if you want to break common HCI you can do that too, for example using the code posted by Bruno Yu here: Using Enter in place of Tab (DataGridView)
 
The code posted is a custom DataGridView class that you use as is, and in place of the standard DataGridView class. Add the class to your project (Project menu, Add Class), and when you have that in place recompile project. Then in Toolbox from project components tab you drag an instance of the custom control to your form, just like you dragged the standard DGV control previously.
 
Back
Top