Keyup, KeyDown, and KeyPress events for a datagrid do not work. URGENT!!!!

  • Thread starter Thread starter Chris Calhoun
  • Start date Start date
C

Chris Calhoun

Here are the three event handlers I am trying to catch the key events, but
they do not work.
private void dgResults_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) {
MessageBox.Show("Key Down!");
}
private void dgResults_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) {
MessageBox.Show("Key Pressed!");
}
private void dgResults_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e) {
MessageBox.Show("Key Up!");
}
 
Chris, you need to tell us a bit more than 'they do not work'. What
happens? How did you hook the events up?
 
with that method below
private void dataGrid1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("key pressed");
}

did you add this
this.dataGrid1.KeyDown += new
System.Windows.Forms.KeyEventHandler
(this.dataGrid1_KeyDown);
 
Back
Top