Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi all,

Please I want to know if there is any problem to use the DataGridView_Key_Down event handler in the same time I am using The DataGridView_Cell_End_Edit or DataGridView_Cell_Validating events handler or when leaving an edited cell in the DataGridView,
If yes please tell me how to fix it.

Thanks in advance,
:)
Posted
Comments
Alan N 6-Mar-11 8:40am    
Rather than asking if we think you might have a problem, why not tell us if you do and what that problem actually is.
Henry Minute 6-Mar-11 10:04am    
If you tell us what problem(s) you are having then we might be able to help.

1 solution

Though the question didn't provide enough, Let me give the general points about those events.

If you look at the order of events the container event KeyDown fires first. Then Cell validating and End Edit if the cell control is in editing mode.

But the key Down of the container won't fire if the cell is in editing mode. Because the event will be captured by the cell and not the gridview.

If you want the gridview capture the specific key events instead of the cell then look at here the workable solution

GridView KeyDown Event Capture;[^]
 
Share this answer
 
Comments
Olivier Levrey 7-Mar-11 5:31am    
My 5. Good answer.
Albin Abel 7-Mar-11 9:49am    
Thanks Olivier
Michael Waguih 8-Mar-11 2:38am    
Thank you it was an excellent answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900