KeyPress at DataGrid

  • Thread starter Thread starter Maqsood Ahmed
  • Start date Start date
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
 
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
 
Back
Top