hello!

I have written a code that writes and reads from the registry.
to write:
Code:
        // Create a new key under HKEY_LOCAL_MACHINE\Software as MCBInc
       RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
        // Add one more sub key
       RegistryKey newkey = key.CreateSubKey("reg");
        // Set value of sub key
        newkey.SetValue("reg", toWrite);
to read:

Code:
        // Create a new key under HKEY_LOCAL_MACHINE\Software as MCBInc
        RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
        // Get sub key
        RegistryKey newkey = key.OpenSubKey("reg");
        // Get value of sub key
        return ((string)key.GetValue("reg"));
the problem is, that I can't read what I wrote! I am able to write to registry.

what is wrong?

thanks!