I want to write a Value in my registry. Im using C# 4.0. Im using following code.
RegistryKey rk = baseRegistryKey;
RegistryKey sk1 = rk.CreateSubKey(subKey);
sk1.SetValue(KeyName.ToUpper(), Value);
this subKey value is "SOFTWARE\POS"
This worked fine in my previous machine. It was Windows 7, 32 bit Operating System. Now im using Windows 7, 64 bit Operating System. Now this program is generates following error when execute RegistryKey sk1 = rk.CreateSubKey(subKey);
line.
"Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\POS' is denied."
I logged as administrator too. But CreateSubKey method is under Microsoft.Win32 Name space.
Please help. Thanks in advance.