Disable ArrowKey

G

Guest

Hello,
I have a datagrid and I would that if I press an arrow key (up and down) the
cursor don't move up and down on the datagrid.
There is a solution for my problem?
I have used keypress and keyup but don't capture the arrow keys.
Only KeyDown capture ArrowUp and ArrowDown but e.Handler = True don't avoid
the event "press arrow key" and the cursor move in the datagrid.

Thank you
Marco
 
D

Dmytro Lapshyn [MVP]

Hello,

In a DataGrid, tapping into keystroke processing is much more complicated.
You will have to override a number of methods, each of them being called
under different circumstances:

ProcessCmdKey - to handle Alt-<Down Arrow>, Alt-Del, Gray + / Gray -
PreProcessMessage - to handle Del
ProcessKeyPreview - to handle +, -, Enter, Arrows and Tab, PgUp, PgDn, also
Esc
ProcessDialogKey - to handle +, -, Enter, Arrows and Tab, PgUp, PgDn, also
Esc (but this one is invoked under different circumstances)

The above assumes .NET 1.1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top