Im trying to save the items in the listbox in Settings.Default but it will not work, this is what i have so far.
test.Properties.Settings.Default.list = listBox1.Items;
Im trying to save the items in the listbox in Settings.Default but it will not work, this is what i have so far.
test.Properties.Settings.Default.list = listBox1.Items;
Changes to properties will not persist if you don't call Save()
afterwards.
test.Properties.Settings.Default.list = listBox1.Items;
test.Properties.Settings.Default.Save();
Have you tried with an ArrayList
?
test.Properties.Settings.Default.list = new ArrayList(listBox1.Items);
test.Properties.Settings.Default.Save();
Then you could load the list back like so:
listBox1.Items.AddRange(test.Properties.Settings.Default.list.ToArray());
I'm also assuming that the items in your list are serializable (either implement ISerializable
or have the SerializableAttribute
).