Today I came across a problem I had never had before. I’m trying to check if a file exists from a value in Windows registry. To be more specific, I’m getting the installation path from Flight Simulator and checking if there is a module installed.
I get the registry key just fine and it is converted to a string (from an object) but I don’t seem to be able to concatenate the filename after it (before is just fine).
RegistryKey pRegKey = Registry.CurrentUser;
pRegKey = pRegKey.OpenSubKey(@"Software\Microsoft\Microsoft Games\Flight Simulator\10.0");
string fSPath = pRegKey.GetValue("AppPath").ToString(); // Receives "S:/Apps/FSX/"
If I show a messagebox like this it does not concatenate:
MessageBox.Show(fSPath + "Modules");
Add the following line:
before using messagebox.