James,
I see it now. You will have to open each sub key, you can't just cast
it to a registry key. You need to do this:
foreach (string subKeyName in Sftw.GetSubKeyNames())
{
// Open the key.
using (RegistryKey subKey = Sftw.OpenSubKey(subKeyName))
{
// Write the value.
Console.WriteLine(subKey.GetValue("DisplayValue"). ToString());
}
}
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"James" <Ja***@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
I'm guessing I just don't know the method to read the subkeys. The only
value I have been able to figure out how to return is the name of the
subkeys... I did try this...
foreach (RegKey SubKey in Sftw.GetSubKeyNames())
{
Console.WriteLine(SubKey.GetValue("DisplayName").T oString());
}
and caught an error converting string to registrykey.
"Nicholas Paldino [.NET/C# MVP]" wrote:
James,
You say it doesn't work. Are you sure you have permission to access
those keys? Also, do you get an exception, or it doesn't return the
value
that you think you should get?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"James" <Ja***@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com... >I am trying to read values to the subkeys under HKLM\...\Uninstall.
>
> I get to this point...
>
> RegistryKey Sftw =
> RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMa chine,
> name).OpenSubKey("software").OpenSubKey("Microsoft ").OpenSubKey("Windows").OpenSubKey("CurrentVersio n").OpenSubKey("Uninstall");
>
> foreach (string SubKey in Sftw.GetSubKeyNames())
> {
>
> }
>
> and now I want to read some of the values to the subkeys. Nothing I
> have
> tried works. All I have been able to accomplish is reading the name of
> the
> subkey itself.
>
> I feel I am missing something here...
>
> Thanks for any assistance!