Prathap

Prathap

  • NA
  • 38
  • 31.4k

How to create 'KeyDown' event programmatically for gridview?

Dec 31 2014 1:15 AM
I have two DataGridViews (DataGridView1 and DataGridView2 ).
I have created KeyDown event for DataGridview1 in
DataGridview1_EditingControlShowing event(object sender, DataGridViewEditingControlShowingEventArgs e)
e.Control.KeyDown +=new KeyEventHandler(Control_KeyDown);
but, when i tried to create same event for DataGridView2 
DataGridview2_EditingControlShowing event(object sender, DataGridViewEditingControlShowingEventArgs e)
{
e.Control.KeyDown +=new KeyEventHandler(Control_KeyDown); //   error:  " handler Control_KeyDown already exists in this class "
}
How to crate KeyDown event Programmatically for DataGridView2 in same windows form?