문제

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.

도움이 되었습니까?

해결책

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

RegistryKey rkSubKey = Registry.CurrentUser.OpenSubKey(@"Software\<<path to key>>", false);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top