Provided its Allowusertoaddrows property is true;
Is it possible to limit the current cell in the same row, may be the cell right to it?
If yes, could anyone help me to do it?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Apr 5, 2010, 4:13 PM
You say "the enter key has no effect". Can you be more specific? Are you totally sure that the enter key has absolutely no effect whatsoever? Is the code I showed you not executing at all for the enter key?
Sam HobbsPosted Apr 7, 2010, 12:53 PM
Irshad IbrahimPosted Apr 7, 2010, 12:29 PM
If the enter key is pressed, the current cell remains the same cell, no effect.
If the Shift key is pressed my other function works and the data has been posted or viewed, ie, the the other cells recieve the data in database according to the value entered. But the current cell moves to current row and (current column + 1).
If any other keys ,ie alphabetic or numeric keys; the pressed value will be appended with the value of the cell.
In what way I should alter the function so that , I could have the same effect when I press the Enter key ?
Irshad IbrahimPosted Apr 5, 2010, 1:42 PM
I have tried your reply. It worked. But the enter key has no effect in datagridview.
All I need is to move the cell focus to fourth cell when I press Enter in 2nd cell.
How could I change the code?
Sam HobbsPosted Mar 19, 2010, 3:13 PM
You can derive from DataGridView but I am not sure of the details of how to use the derived DataGridView. You can then override ProcessCmdKey in the derived class.
Alternatively, you can override ProcessCmdKey in the form class. If you override ProcessCmdKey in the form class, then you would need to check to determine if the DataGridView is in focus. Override ProcessCmdKey in the form class using something such as: