FORUMS
Remove All Ads from XDA

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

201 posts
Thanks Meter: 2
 
By cichy3000, Senior Member on 30th March 2009, 02:23 PM
Post Reply Email Thread
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, 08:41 PM |#2  
[germany]merlot's Avatar
Senior Member
Thanks Meter: 0
 
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

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes