B
Brian8568
I'm doing something wrong. I'm trying to delete a registry value with
the following code VB 2005 Express:
Dim oReg As Microsoft.Win32.RegistryKey
oReg =
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
Try
oReg.DeleteValue("AlcWzrd")
Debug.Print("Successfully Delete Registry Key AlcWzrd")
Catch ex As Exception
Debug.Print(ex.ToString)
Finally
oReg.Close()
End Try
This fails with:
A first chance exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll.
Cannot write to the registry key.
I'm running this under an admin account and I can add and remove this
key in RegEdit. What am I doing wrong?
the following code VB 2005 Express:
Dim oReg As Microsoft.Win32.RegistryKey
oReg =
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
Try
oReg.DeleteValue("AlcWzrd")
Debug.Print("Successfully Delete Registry Key AlcWzrd")
Catch ex As Exception
Debug.Print(ex.ToString)
Finally
oReg.Close()
End Try
This fails with:
A first chance exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll.
Cannot write to the registry key.
I'm running this under an admin account and I can add and remove this
key in RegEdit. What am I doing wrong?