I would like to read value in the registry using C#, if the values are not in the registry I create it. I have a reading problem:
RegistryKey regKey1 = Registry.CurrentUser;
regKey1 = regKey1.CreateSubKey(@"SOFTWARE\PNMDISPATCHER");
if (regKey1 != null)
{
textBoxTaux1.Text = regKey1.GetValue("Taux1").ToString();
}
I have the NullReferenceException when execute the GetValue function.
My values are in the registry, so why i get this error?
Looks like the RegistryKey.GetValue is returning null and cannot do .ToString()
Taken from MSDN for RegistryKey.GetValue: