PDA

View Full Version : Help with Regkeys


mattspew
09-13-2007, 08:43 PM
I'm trying to put some info in a regkey from the users input on the users information screen.

Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\MyApp");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\MyApp", "UserName", "%UserName%", REG_SZ);

It creates the key "MyApp" and the value "UserName", but it sets the value of "UserName" to "%UserName%". It's not grabbing the value from the session variable.

The session variable for "UserName" is %UserName%.

I know it will have to be something simple, but... :huh

mattspew
09-13-2007, 08:55 PM
Never mind, I should have searched the forum before asking...

Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\MyApp", "Username", SessionVar.Expand("%UserName%"), REG_SZ);