I 'm trying to Create and Set values in the registry. How do I set permissions so that my program has access to do this in Vb.Net?
Printable View
I 'm trying to Create and Set values in the registry. How do I set permissions so that my program has access to do this in Vb.Net?
hmm i didnt know you need to set any permissions!! Have you actually tried writing to the reg?
He might need to if the program is running of Win2000 or WinXP.
I think you can only write to the CurrentUser keys....not sure.
If you are talking about computer permissions then you must have administrative rights but if your talking about your program being able to write to the registry it is just a True or Flase.
For example this is how I wrote to the registry in my last program.
Dim GetRegKey As RegistryKey
GetRegKey = Registry.LocalMachine.OpenSubKey("Software\Folder\Subfolder", False ) 'change to true if you need to write
Integer1 = CInt(GetRegKey.GetValue("Intvalue", ""))
String1 = Convert.ToString(GetRegKey.GetValue("Strvalue", ""))
GetRegKey.Close()
If you are writing the the registry then instead of saying someting = CInt.... then just put
PutRegKey.SetValue("Value", "1") or PutRegKey.SetValue("Name","my name is not fred")
Hey,
When I type
I don't get the keyword RegistryKey drop down in the autocomplete. Do I need to add a reference to it?Code:Dim RegKey as
:confused:
Yes, it is in the Microsoft namespace.
uh-huh!!!
found it!
thanksCode:Dim RegKey As Microsoft.Win32.RegistryKey
;)
hmmm.... now i keep getting this message:
n unhandled exception of type 'System.NullReferenceException' occurred in App01.exe
any ideas?
i went into the registry and created the key manually. is there a function that says "IfExists"?
Strangely enough, a couple of articles down in the forum list, there is:
"Test if registry key exists"
http://www.vbforums.com/showthread.p...hreadid=220853
:eek:
sorry. hungover ..... again:D