I have a DataGridView inside of the winform with delete event handled from toolstrip menu which delete the selected row (along with the object associated with that row in the DataGridView).
Now when i try to edit the value of any cell (to rename the object), and in the edit mode if i select some characters and press delete, it delete the row instead of deleting those selected characters.
What should i do to make the cell handle the event rather than the Winform.
snippets below:
this.deleteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.OnDelete);
private void OnDelete(object sender, EventArgs e)
{
}
Found a solution 🙂
when i enter into edit mode i remove the delete key association
this.deleteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.None;
and once i am done editing the cell in the OnAfterEdit i set it back to
this.deleteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
Hope it helps someone.