I'm trying to retrieve the version of excel from the registry but I have problems using the
Registry.GetValue(...)
method
The value I am trying to retrieve is in HKEY_CLASS_ROOT\Excel.Application\CurVer But I do not know what name to put as a parameter in the GetValue method.
I tried :
RegistryKey key = Registry.ClassesRoot;
RegistryKey subKey = key.OpenSubKey(@"Excel.Application\CurVer");
// Also tried w/o the "\CurVer"
return subKey.GetValue("CurVer");
But I keep getting a NullReferenceException on the GetValue
The version number is the default value.
To get this you need:
string s = reg.GetValue(null).ToString();
RegistryKey key = Registry.ClassesRoot;
RegistryKey subKey = key.OpenSubKey(@"Excel.Application\CurVer");
return subKey.GetValue("");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With