Hello Folks,
I'm trying to write a program though which I can access my system registry. Both reading and writing actions have been encapsulated. Among these I have successfully done with reading a key value from my registry. But the storm arises when I make my move to write to registry. This is the code which I used for creating a key and then storing a string type value....
using Microsoft.Win32;
Private Void cmdRead_Click()
{
RegistryKey HKCU=Registry.CurrentUser;
RegistryKey subKeys=HKCU.OpenSubKey("Software\\VB and VBA Program Settings\\Company\\");
[B]RegistryKey newSubKey=subKeys.CreateSubKey("Login Status");[/B]
newSubKey.SetValue("Status","Logged In");
newSubKey.Close();
subKeys.Close();
HKCU.Close();
}
I'm getting an exception in the BOLDED line. This is the exception which I'm getting :-
"UnAuthorizedAccessException"
"Can't write in to the registry key."
Experts in C# plz help me to sort out this problem....
Thanks in advance...
regards
Shouvik