document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.         // These routines manage the "Edit on F2" feature where the entire row
  2.         // goes into edit mode on keypress of the F2 key.
  3.         // make sure you attach them to all the grids in your project
  4.         private void Grid_KeyUp(object sender, KeyEventArgs e)
  5.         {
  6.             DataGridView dg = (sender as DataGridView);
  7.             if (e.KeyCode == Keys.F2)
  8.             {
  9.                 if (dg.EditMode != DataGridViewEditMode.EditOnKeystroke)
  10.                 {
  11.                     dg.EditMode = DataGridViewEditMode.EditOnKeystroke;
  12.                     dg.BeginEdit(false);
  13.                 }
  14.             }
  15.         }
  16.  
  17.         private void Grid_RowLeave(object sender, DataGridViewCellEventArgs e)
  18.         {
  19.             DataGridView dg = (sender as DataGridView);
  20.             save();
  21.             dg.EditMode = DataGridViewEditMode.EditProgrammatically;
  22.         }
');