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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Apr 5, 2010, 12:13 PM EDT
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 HobbsRank #107 · 20.5K reputationPosted Mar 19, 2010, 11:13 AM EDT
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:
Irshad Ibrahim12 reputationPosted Apr 5, 2010, 9:42 AM EDT
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?
Irshad Ibrahim12 reputationPosted Apr 7, 2010, 8:29 AM EDT
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 ?
Sam HobbsRank #107 · 20.5K reputationPosted Apr 7, 2010, 8:53 AM EDT