C# Programming
10-08-2011, 11:02 AM
Greetings Gurus,
Could you help please?
I am querying the registry to get a list of installed programs, this works.
I am trying to locate a value in the list of returned items, this doesn't work.
e.g.
RegistryKey rk = Registry.LocalMachine; RegistryKey rkprograms = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall"); foreach (string s in rkprograms.GetSubKeyNames()) { int idx; idx = s.IndexOf(".NET");// see if anything with .NET in the name is installed e.g. Microsoft .NET Framework Console.WriteLine(idx); { Console.WriteLine(s); } Console.ReadKey(true); }but all "idx" values return "-1" i.e. not found.
Is my method faulty?
Could you help please?
I am querying the registry to get a list of installed programs, this works.
I am trying to locate a value in the list of returned items, this doesn't work.
e.g.
RegistryKey rk = Registry.LocalMachine; RegistryKey rkprograms = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall"); foreach (string s in rkprograms.GetSubKeyNames()) { int idx; idx = s.IndexOf(".NET");// see if anything with .NET in the name is installed e.g. Microsoft .NET Framework Console.WriteLine(idx); { Console.WriteLine(s); } Console.ReadKey(true); }but all "idx" values return "-1" i.e. not found.
Is my method faulty?