KeyPress at DataGrid

M

Maqsood Ahmed

Hello,
I want to ask that is there any way to get "Arrow Keys" press on
DataGrid, KeyPress, KeyDown and KeyUp events don't work for ArrowKeys.
TIA.

Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
 
C

ClayB [Syncfusion]

One way you can do this is to derive the datagrid and override
ProcessCmdKey.

public class MyDataGrid : DataGrid
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
Console.WriteLine("ProcessCmdKey");
if(keyData == Keys.Right)
return true;// you handled it
return base.ProcessCmdKey (ref msg, keyData);
}
}

===================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools
 

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

Similar Threads

Disable ArrowKey 2
KeyPress Not Firing 3
Customize toolbars 1
DataGrid's Header Colors 2
NumericUpDown 1
AcceptButton and Key-Events 1
Help with Regex 5
Storing information in an image 1

Top