Click here to Skip to main content
15,881,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I edit or add new key to local machine while I'm working on Windows 7 with C# code?
Posted
Updated 20-Apr-13 7:43am
v3
Comments
Richard MacCutchan 20-Apr-13 12:21pm    
You need to be an administrator to change the local machine keys.
prince.Hassan22 20-Apr-13 12:25pm    
Im an adminstrator (if you mean log as computer admin when usig the application)
Richard MacCutchan 20-Apr-13 13:15pm    
Then you need to set your program to use administrator privileges; you can do this by selecting the proper level in your manifest. See this article for details.

1 solution

Hi,

Have a look here:
Read, write and delete from registry with C#[^]
http://msdn.microsoft.com/en-us/library/vstudio/h5e7chcf.aspx[^]

Please note: you should run your application as Administrator, otherwise you can't access the registry.
 
Share this answer
 
v3
Comments
prince.Hassan22 20-Apr-13 12:06pm    
the Problem Is That I Cannot Access To Local_Machine Keys It Gives Me Error That I Need Permission And I Don't Know How To Get This Permission
Ian A Davidson 20-Apr-13 12:35pm    
I think that's what the others have been saying - you need to run your application as local admin.
Regards,
Ian.
prince.Hassan22 20-Apr-13 12:41pm    
That's What Im Really Doing Im Running As Admin But I Cann't Edit Local_Machine (note This Only Happens When I Use Win 7 But It's Ok In Xp) :\
Thomas Daniels 20-Apr-13 12:48pm    
If you're logged on as admin, but if you still get an error, then right-click on your application, and choose Run as Administrator.
prince.Hassan22 20-Apr-13 12:55pm    
what if im debugging it using visual studio 2010?

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