January 4th, 2011, 11:04 PM
Object reference not set to an instance of an object.
Hi, im new to c# and new to this forum.
Win 7 64bit
.net 3.5 (using vs2008)
I found this code online to get the 'UninstallString' from a specific subkey within the registry. I am trying to debug the code but im getting the 'Object reference not set to an instance of an object.' error.
I broke down the code in order to find where it was giving me the error and its at the point where the code posted below has *** ***.
Im not really sure how to fix this. I previously put a try and catch but it would still break the program. Any help on this would be appreciated.
String AppName = "Abode AIR";
RegistryKey ReadReg = Registry.LocalMachine
String SubNames = ReadReg.GetSubKeyNames();
Console.ReadLine(); //Dont mind this line
for (int i = 0; i < SubNames.Length; i++)
RegistryKey temp = ReadReg.OpenSubKey(SubNames[i])
***if (temp.GetValue("DisplayName").ToString() == AppName)***
Thanks for your support
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!