Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registry problem

Status
Not open for further replies.

erithracus

Programmer
Oct 31, 2002
12
0
0
NL
Hello,

The C# application I am developing writes several issues using the Registry classes, to the registry. These issues are retreived later.
Apparently this works fine. If I close the application and restart it again, the correct values are retreived from the Registry.
However the nest time I start the computer the registry settings seem to be lost.

Is there anybody who knows how to make changes to the registry more permanent?

TIA,

Jan
 
Which part of the registry are you writing to? Part of it is wiped out after a reboot (HKEY_CURRENT_CONFIG), part is per-user (HKEY_CURRENT_USER, HKEY_USERS), and part of it is maintained (HKEY_CLASSES_ROOT, HKEY_LOCAL_MACHINE).

And...

Is the computer under Systems Management Server? (which can reload the registry from a standard template at boot-time).

Chip H.
 
Chip,

Thanks for thinking with me.
The problem is solved now. It appeared to be related to a wrong use of the Registry class.

Where I did:
Registry.LocalMachine.CreateSubkey(mykey);
Registry.LocalMachine.SetValue(mykey,"blabla");

I should have done:

RegistryKey regkey = Registry.LocalMachine.CreateSubkey(mykey);
regkey.SetValue(mysubkey,"blabla");

Jan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top