Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[C#] [VS2008] Registry - 'System.UnauthorizedAccessException'

OP cichy3000

30th March 2009, 03:23 PM   |  #1  
cichy3000's Avatar
OP Senior Member
Thanks Meter: 1
 
195 posts
Join Date:Joined: Feb 2008
More
Hi all,
I'm writing application that will allow users to change values in TouchFlo Registry Settings ... Some touchflo improvements, and when app goes to doing this code:

Code:
RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWARE\\OEM\\TFLOSettings");
reg.SetValue("PageHigh", inputed_value);
i got : 'System.UnauthorizedAccessException' and app just crashes... :/

i would be really grateful, for helping me with it... how can i set value to the registry ?
30th March 2009, 09:41 PM   |  #2  
[germany]merlot's Avatar
Senior Member
Thanks Meter: 0
 
198 posts
Join Date:Joined: Oct 2007
More
Quote:
Originally Posted by cichy3000

Code:
RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWARE\\OEM\\TFLOSettings");
reg.SetValue("PageHigh", inputed_value);

You need to open the registry key this way:

Code:
RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWARE\\OEM\\TFLOSettings", true);
reg.SetValue("PageHigh", inputed_value);
true means that you have write permission on the specified key. When you open the key as false you only have read permission.

PS: Please use next time the Q&A forum and Google.com
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes