HANDLING SHIFT DEL IN C#

Takeshi Okada

Total Post:89

Points:629
Posted by  Takeshi Okada
C# 
C#
 1887  View(s)
Ratings:
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

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Handling Shift Del in C#

    Hi Takeshi!


    Try in KeyUp Event

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!