Nouman Zakir

while (true) { Post.NewArticle(); }
posts - 13, comments - 12, trackbacks - 0

My Links

News

Archives

Post Categories

Personal Website

Sunday, January 11, 2009

Save Configuration Settings in Registry

First, go to AssemblyInfo.cs and remove all asterisks from the AssemblyVersion:
[assembly: AssemblyVersion("1.0.0.0")]

Otherwise, every time you build your application the registry key will change.
Save configuration values to the registry as follows:

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

Load configuration values to the registry as follows:

try
{
Value = (int) Application.UserAppDataRegistry.GetValue("Value");
}
catch(Exception)
{
}

The GetValue method will throw an exception if the specified value does not exist in the registry.

posted @ Sunday, January 11, 2009 9:58 PM | Feedback (0) |

Powered by: