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

Total Post:89

Points:629
Posted on    February-12-2013 2:52 AM

 C# C# 
Ratings:


 1 Reply(s)
 1528  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



AVADHESH PATEL

Total Post:604

Points:4228
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