Read Registry using C#





5.00/5 (2 votes)
This is the code that I use:For lookup:RegistryKey rkn = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Test");dwResult = rkn.GetValue("Preferences");For update:RegistryKey rkn = Registry.LocalMachine.CreateSubKey(szKeyPath); dwResult = rkn.ValueCount;rkn.SetValue(szKey,...
This is the code that I use:
For lookup:
RegistryKey rkn = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Test");
dwResult = rkn.GetValue("Preferences");
For update:
RegistryKey rkn = Registry.LocalMachine.CreateSubKey(szKeyPath);
dwResult = rkn.ValueCount;
rkn.SetValue(szKey, szValue);
For insert:
RegistryKey rkn = Registry.LocalMachine.CreateSubKey("Software\\Test");
rkn.SetValue("Preferences1", "xxxx");
I hope that helps.