Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to make myapplication work via registry.setvalue()...
C#
Registry.SetValue("HKEY_CURRENT_USER\\Software\\ZSPL", "Asset", "AssetManager");
Registry.setvalue(my project);

not working...
Posted
Updated 17-Apr-13 3:25am
v2
Comments
[no name] 17-Apr-13 9:32am    
You would have to tell us what "not working" means. The code that you have posted would not work as C# is a case sensitive language. Registry.setvalue would not even compile much less run. As a side note, reading and complying with the posting guidelines would really help you get some answers to your many, many, many questions and then maybe you could start accepting some of those answers as helping you which in turn helps others with similar problems.

Check example here :

Win32 Registry Setvalue
 
Share this answer
 
v2
Add this to the beginning of the source file
using Microsoft.Win32;


This works fine for me. I tested it!
Registry.SetValue("HKEY_CURRENT_USER\\Software\\ZSPL", "Asset", "AssetManager");


Your second statement Registry.setvalue(my project); won't work because SetValue letter case is incorrect and you only pass one parameter when three are expected.
 
Share this answer
 
I agree that you need to provide us with more information about why it's not working.

My immediate guess is this:

You have to run your application with Admin rights to change the registry. It's not enough that your user account is an admin account.

You can do this by changing the program manifest: Right click your project in the solutions explorer, add new item and choose application manifest.

Open the manifest and change

HTML
<requestedexecutionlevel level="asInvoker" uiaccess="false" />

to
HTML
<requestedexecutionlevel level="requireAdministrator" uiaccess="false" />


Just my guess...


Another thing: I think you need a @ here:

Registry.SetValue(@"HKEY_CURRENT_USER\\Software\\ZSPL", "Asset", "AssetManager");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900