Using registry to save configuration setting

Hi

In windows application most of the time we have many configuration data, that need to be maintained for the application. This data can be easily saved in the application setting. But many a time we want to save the data in the registry. Here is how we do that/

To save the configuration values to the registry use the UserAppDataRegistry.SetValue method.

Application.UserAppDataRegistry.SetValue("Value", Value);

Now to load the values from the registry we have to use the getValue method. Always use this method inside the try and catch block because it will throw an exception if the value is not present in the registry.

Also remember to remove all the asterisks in the assembly version from the assembly.cs file and give it a proper assembly version otherwise the registry key will change every time you build the application.

Hope this helps
Thanks
Vikram


Share this post   Email it |  digg it! |  reddit! |  bookmark it!

Feedback

Posted on 5/29/2008 7:06:04 AM

thanx for providing such helpful articles!!

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 - 2009 Vikram Lakhotia