Hello All,

    I'm in the middle of a project that reads/writes to/from the registry
but I've encountered a very weird problem.  Consider the following code:

-----

RegistryKey rootKey = Registry.CurrentUser;

RegistryKey myKey = rootKey.OpenSubKey("\\Software\\MyApp", true);

myKey.SetValue("Name", "MyAppName");

myKey.Close();

rootKey.Close();

-----

    Every time I run this code I get an Unhindered Exception Error (the
exact type is: System.NullReferenceException).  After doing some digging I
found out that for some weird reason after the call to OpenSubKey() myKey is
still null.  Why is that ?  What am I doing wrong ?  Thanks in advanced...

-Pete

---
Peter Vertes
TheBEAST.com, Inc.
404 Fifth Ave
New York, NY
10018

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