Yep there was data in the key but yours truely made a typeo in the keyname.
Duh !  Thanks for the help though :)

-Pete

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
Marsh, Drew
Sent: Thursday, May 09, 2002 4:33 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Is this a bug in RegistryKey.GetValue() ?


Peter Vertes [mailto:[EMAIL PROTECTED]] wrote:

> Console.WriteLine(_remoteKey.GetValue("Foo Bar").ToString());
>
>     I get an exception saying: "Object reference not set to
> an instance of an object".  The only thing that has changed
> here is that the key name whos value I want to get contains a
> space.  The space shouldn't matter because my keyname is in
> quotes, right ?  Is this a bug in RegistryKey.GetValue() or
> am I just overlooking something ?

Did a value for "Foo Bar" exist? If not then null would be returned and
you'd be trying to call .ToString() on null.

HTH,
Drew

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to