0

I'm playing with Visual Basic .Net 2005. I wanted to create a program that can write to the registry.

This gives me an UnauthorizedAccessException:

Dim myKey, softwareKey As Microsoft.Win32.RegistryKey
softwareKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE")
myKey = softwareKey.CreateSubKey("mykey")

But this works:

Dim p as Process
p = Process.Start("reg.exe", "add HKCU\Software\mykey")

I'm on XP SP3 and my user is an Admin. What needs to be changed in order for my software to write to the registry through the .Net Framework?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.