I am trying to load the path of a file from registry
but I am facing a problem, when I use \
in string, it is saved as \\
and when I use \\
(to make it \ in path string) it is also saved as \\
. Here's what I am trying to do:
Because of that \\
I always get null in key
variable. How can I resolve this issue?
Any help will be appreciated.
Hi The problem is not the escape chars which windows will apply to all uri's
The problem is with the opensubkey method, here you are submitting a key/value so the code you have is looking for a subkey of RibbonUi.xml which does not exist.
Instead seperate the key/value lookup and all will work out fine.
RegistryKey rkApp =
Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (rkApp.GetValue("MyTestRun_Key_Value") == null)
{
checkbox1.Checked = false;
}
else
{
checkbox1.Checked = true;
}