I’m trying save settings for my application with tabs. Each tab show some data from path. I store it like this:
private Dictionary<int, string> _listTabs = new Dictionary<int, string>();
when I create new tab, I add new Item in dictionary
_listTabs.Add(listTabs.Count++,CurrentPath);
before closing programm I want to save this dictionary in settings:
foreach(KeyValuePair kvp in _listTabs)
{
var property = new SettingsProperty(kvp.Key);
property.DefaultValue = kvp.Value;
Settings.Default.Properties.Add(property);
}
Settings.Defaut.Save();
But, it doesnt work. Where are the mistakes?
You’d need to tell us what the error is that you are seeing if the application is failing for some reason.
Also in your code above, I can’t see any method to Save the settings
For more info on user settings take a look at Using Settings in C# with specific focus on the area of Using Settings at Run Time.
Once you’ve established that this works, check the user settings file. This Answer shows you where the settings are saved to.