Home > DeveloperSection > Forums > Handling Shift Del in C#
Takeshi Okada
Takeshi Okada

Total Post:89

Posted on    February-12-2013 2:52 AM

 C# C# 

 1 Reply(s)
 1816  View(s)
Rate this:

Hi Expert!

I am having a DataGridView in a winform with delete handled which authenticates and deletes those rows. However, pressing Shift+Del deletes the rows from

UI. I have tried setting a boolean IsShiftPressed by handling keydown event but that looks ugly. Surely there should be a better way to do it.

Please reply ASAP! Thanks


Total Post:604

Posted on    February-12-2013 9:00 AM

Hi Takeshi!

Try in KeyUp Event

if (e.KeyCode == Keys.Del && e.Shift) 
   if (dataGridView1.SelectedRows.Count > 0) 
        //Do Stuff 
   e.Handled = true;

Don't want to miss updates? Please click the below button!

Follow MindStick