I have a ListBox on my Form, I want to save it and load the values when I start the application again.
How can I save a list on PrjName.Properties.Settings.Default
?
I have a ListBox on my Form, I want to save it and load the values when I start the application again.
How can I save a list on PrjName.Properties.Settings.Default
?
When using the natively supported Type System.Collections.Specialized.StringCollection
I used this code:
No problem at all! Create a new setting, e.g. "MyListOfStrings", type doesn't matter.
then open settings file in a xml editor
your file will look like this:
now change it as shown below and save it
well, that's all, now it will look like that:
and in code:
I found out that I can't directly save a
List<string>
on the application settings, but I saw that I can save aStringCollection
.And here I found out that it's very simple to convert from a
StringCollection
to aList<string>