emeh
emeh

Reputation: 823

Storing default value in Application settings (C#)

I am using Application settings to store and retrieve my GUI settings. For one of the setting

Name - FileDirectory

Type - String

Scope - User

Value - Problem?? i need to store Desktop folder path i.e Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

I can't set this in Settings Page. How can i set this default value?

P.S I am using C# (.Net 2.0)

Upvotes: 0

Views: 1865

Answers (1)

Xstahef
Xstahef

Reputation: 654

may be a check at startup :

if(string.IsnullOrEmpty(Settings.Default.FileDirectory))
{
Settings.Default.FileDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Settings.Default.Save();
}

Hope this help.

Upvotes: 3

Related Questions