G
Guest
Hi All,
I am attempting to write values to the registry, but get an
UnauthorizedAccessException when I try to do a SetValue on an existing key.
However, I can create the key, with a value, when it does not exist.
Here is a snippet of the code:
Dim RegKey As RegistryKey
RegKey = Registry.LocalMachine.OpenSubKey(BaseKey & "\" &
SubKey, False)
If (RegKey Is Nothing) Then
RegKey = Registry.LocalMachine.CreateSubKey(BaseKey &
"\" & SubKey)
End If
Try
RegKey.SetValue("NumberRuns",
Tasks(I).NumberRuns.ToString())
RegKey.SetValue("TotalSeconds",
Tasks(I).TotalSeconds.ToString())
Catch ex As Exception
MessageBox.Show("Exception: " & ex.Message)
Finally
RegKey.Close()
End Try
What do I need to do to be able to update this key?
Thanks,
pagates
I am attempting to write values to the registry, but get an
UnauthorizedAccessException when I try to do a SetValue on an existing key.
However, I can create the key, with a value, when it does not exist.
Here is a snippet of the code:
Dim RegKey As RegistryKey
RegKey = Registry.LocalMachine.OpenSubKey(BaseKey & "\" &
SubKey, False)
If (RegKey Is Nothing) Then
RegKey = Registry.LocalMachine.CreateSubKey(BaseKey &
"\" & SubKey)
End If
Try
RegKey.SetValue("NumberRuns",
Tasks(I).NumberRuns.ToString())
RegKey.SetValue("TotalSeconds",
Tasks(I).TotalSeconds.ToString())
Catch ex As Exception
MessageBox.Show("Exception: " & ex.Message)
Finally
RegKey.Close()
End Try
What do I need to do to be able to update this key?
Thanks,
pagates