title: How do I delete a registry key?
body: <p>This is my code:</p>
  
  <pre><code>Dim exePath As String = Application.ExecutablePath()
  Dim key As Microsoft.Win32.RegistryKey
  key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store", True)
  key.DeleteValue(exePath)
  </code></pre>
  
  <p>But I don't know why the application doesn't delete that key.</p>
  
  <p>Example: It finds the key but it doesn't delete that key</p>
  
  <p><a href="https://i.stack.imgur.com/BoyNM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BoyNM.png" alt="enter image description here"></a></p>