I am working on grid view in c#. I want to attach a key press listener with grid view to dectect up and down keys. I tried "Editcontrol" but it didnt worked. Also "Keypressed event" with grid view , it also didnt worked. Before that I used "Mouse Event" and it worked the way i want... Any help will be greatly appreciated.

6 Years
Discussion Span
Last Post by TnTinMN

I am a bit confused about which control you want to monitor (DGV vs EditControl).

If it is for the DGV and the arrow-up and arrow-down keys, then try using the DGV.KeyDown event.


I want to control a row inside DGV. I have already applied the keypress event with DGV but it doesnt work.


You will probably need to go one level lower in the event order; that is why I suggested the KeyDown event. You may need to use the PreviewKeyDown event and set the IsInputKey property.

Votes + Comments
Solved the problem. Thanx
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.