Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
How can I edit or add new key to local machine while I'm working on Windows 7 with C# code?
Posted 20-Apr-13 6:24am
Edited 20-Apr-13 8:43am
CPallini326.2K
v3
Comments
Richard MacCutchan at 20-Apr-13 12:21pm
   
You need to be an administrator to change the local machine keys.
prince.Hassan22 at 20-Apr-13 12:25pm
   
Im an adminstrator (if you mean log as computer admin when usig the application)
Richard MacCutchan at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v3
Comments
prince.Hassan22 at 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 at 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 at 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) :\
ProgramFOX at 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 at 20-Apr-13 12:55pm
   
what if im debugging it using visual studio 2010?
ProgramFOX at 21-Apr-13 7:14am
   
If you run Visual Studio as Administator by right clicking on the shortcut to Visual Studio and choosing Run as Administrator, Visual Studio will run your application as administrator also.
prince.Hassan22 at 20-Apr-13 12:57pm
   
Ok Fox you Were Right it Worked Only When I Right Click And Run It As Admin
But If i Want To Be Admin When I Double Click On It What Should I DO?
ProgramFOX at 21-Apr-13 7:15am
   
CPallini at 20-Apr-13 13:43pm
   
5.
ProgramFOX at 21-Apr-13 7:13am
   
Thank you!
prince.Hassan22 at 20-Apr-13 13:58pm
   
Ok Thanks Fox Every Thing Were Ok Thanks For Your Help Again
But May I ask You If You Have a facebook account If I Can Contact You?
ProgramFOX at 21-Apr-13 7:13am
   
No, I don't have a Facebook account. I also don't need it, and to be honest, I don't want it.
prince.Hassan22 at 21-Apr-13 14:56pm
   
that's okay anyway thanks for your help
ProgramFOX at 22-Apr-13 11:42am
   
You're welcome!

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

  Print Answers RSS
0 OriginalGriff 386
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 215
3 Maciej Los 169
4 /\jmot 169
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100