---
title: "Handling Shift Del in C#"  
description: "Handling Shift Del in C#"  
author: "Takeshi Okada"  
published: 2013-02-12  
updated: 2013-02-12  
canonical: https://www.mindstick.com/forum/591/handling-shift-del-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Handling Shift Del in C#

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!

I am having a [DataGridView](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) in a winform with [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) handled which authenticates and deletes those rows. However, pressing Shift+Del deletes the rows from

UI. I have tried setting a [boolean](https://www.mindstick.com/forum/160332/how-does-the-boolean-function-work) IsShiftPressed by [handling](https://www.mindstick.com/forum/34585/file-handling) keydown [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) but that looks ugly. Surely there should be a better way to do it.

Please reply ASAP! Thanks

## Replies

### Reply by AVADHESH PATEL

Hi Takeshi!\
Try in KeyUp Event\

```
if (e.KeyCode == Keys.Del && e.Shift) {    if (dataGridView1.SelectedRows.Count > 0)    {         //Do Stuff    }    e.Handled = true; } 
```


---

Original Source: https://www.mindstick.com/forum/591/handling-shift-del-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
