---
title: "How to delete a existing subkeys under registry"  
description: "How to delete a existing subkeys under registry"  
author: "Anupam Mishra"  
published: 2016-01-21  
updated: 2016-01-21  
canonical: https://www.mindstick.com/forum/33906/how-to-delete-a-existing-subkeys-under-registry  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# How to delete a existing subkeys under registry

I want to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) a existing subkeys under the [root](https://answers.mindstick.com/qa/49855/tell-me-what-is-root-port-in-spanning-tree-protocol) key in my [local](https://www.mindstick.com/forum/546/how-to-create-local-user-in-windows-8) machine. Please give me a appropriate example to delete a existing subkey.\
thank you.

## Replies

### Reply by Anupam Mishra

Code for delete a existing [subkeys:](https://www.mindstick.com/forum/33898/how-to-create-a-new-subkeys-under-registry)

\

\

```
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Anupam Software", true))                {                    if (key == null)                    {                        //Don't need write anything                    }                    else                    {                        key.DeleteValue("Anupam");                    }                }
```


---

Original Source: https://www.mindstick.com/forum/33906/how-to-delete-a-existing-subkeys-under-registry

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
