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.

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.

commented: Solved the problem. Thanx +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.