i would like to write my event that will react on specific keys in my custom DataGrid (WinForms)...

S

Serdge Kooleman

i would like to write my event that will react on specific keys in my custom DataGrid (WinForms)...
please help to do this.


so far i have this custom grid...
and i create it in main object


namespace CustomGrid

{

public delegate void ArrowKeyPressed(object sender, System.Windows.Forms.KeyEventArgs e);

public class DataGridSE : System.Windows.Forms.DataGrid

{

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

{

if (keyData == Keys.Up || keyData == Keys.Down)

{

MessageBox.Show("Yes");

return true; //EVENT HANDLED

}

else

{

return base.ProcessCmdKey(ref msg, keyData);

}

}


}

}
 
O

Ollie Riches

have you had a look at DataGridTextBox.ProcessKeyMessage method for
datagrids:

http://msdn.microsoft.com/library/d...ataGridTextBoxClassProcessKeyMessageTopic.asp

HTH

Ollie Riches

i would like to write my event that will react on specific keys in my custom
DataGrid (WinForms)...
please help to do this.


so far i have this custom grid...
and i create it in main object


namespace CustomGrid
{
public delegate void ArrowKeyPressed(object sender,
System.Windows.Forms.KeyEventArgs e);
public class DataGridSE : System.Windows.Forms.DataGrid
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Up || keyData == Keys.Down)
{
MessageBox.Show("Yes");
return true; //EVENT HANDLED
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
}
}
}
 

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