Question

OK, so I am having a particularly bad day and can't seem to figure out why this line of code is not returning the results it should be.

RegistryKey rkSubKey = Registry.CurrentUser.OpenSubKey(@"\Software\<<path to key>>", false);

The value is written into the registry from a form with 2 text boxes, it writes as it should and there is a value in the registry and I cannot for the life of me see why rkSubKey is returning as a null value.

I read on the MSDN forums that it could be related to 64 bit software accessing a 32 bit registry .. but in my app settings 32 bit is preferred.

Any help would be greatly appreciated.

Était-ce utile?

La solution

The problem is in the leading backslash, just delete it :)

RegistryKey rkSubKey = Registry.CurrentUser.OpenSubKey(@"Software\<<path to key>>", false);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top