Deletes the specified subkey. To delete child subkeys, use DeleteSubKeyTree. The string subKey is not case sensitive.
[Visual Basic] Public Sub DeleteSubKey( _ ByVal subkey As String _ ) [C#] public void DeleteSubKey( string subkey ); [C++] public: void DeleteSubKey( String* subkey ); [JScript] public function DeleteSubKey( subkey : String );
Exception Type | Condition |
---|---|
InvalidOperationException | thrown if the subkey has child subkeys. |
ArgumentNullException | thrown if the subkey is null. |
SecurityException | if the user does not have RegistryPermission.SetInclude(delete, currentKey) access. |
This function must perform identically in Win95 and NT, so do explicit checking for child subkeys, as this is not illegal in Win95.
RegistryKey Class | RegistryKey Members | Microsoft.Win32 Namespace