Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // These routines manage the "Edit on F2" feature where the entire row
- // goes into edit mode on keypress of the F2 key.
- // make sure you attach them to all the grids in your project
- private void Grid_KeyUp(object sender, KeyEventArgs e)
- {
- DataGridView dg = (sender as DataGridView);
- if (e.KeyCode == Keys.F2)
- {
- if (dg.EditMode != DataGridViewEditMode.EditOnKeystroke)
- {
- dg.EditMode = DataGridViewEditMode.EditOnKeystroke;
- dg.BeginEdit(false);
- }
- }
- }
- private void Grid_RowLeave(object sender, DataGridViewCellEventArgs e)
- {
- DataGridView dg = (sender as DataGridView);
- save();
- dg.EditMode = DataGridViewEditMode.EditProgrammatically;
- }
Advertisement
Add Comment
Please, Sign In to add comment