I want to add the items of a listBox to a list inside Properties.Settings.Default but it doesn't work at all. I add items to my listBox with a messagebox i added from the Microsoft.VisualBasic library and then add the input to the listBox:
private void Button_additem_Click(object sender, EventArgs e)
{
    string itemname = Interaction.InputBox("Item hinzufügen", "Gib unten den Namen des Items ein.", "");
    if (itemname.Length > 0)
    {
        listbox_items.Items.Add(itemname);
    }
    else { }
    Save();
    Restore();
}
After that i am using my Save() and Restore() voids:
private void Save()
{
    if (Properties.Settings.Default.myList == null)
    { }
    else 
    { 
        Properties.Settings.Default.myList.Clear(); 
    }
    foreach (object item in listbox_items.Items)
    {
        Properties.Settings.Default.myList.Add(item);
    }
    Properties.Settings.Default.Save();
}
private void Restore()
{
    combobox_montag.Items.Clear();
    combobox_dienstag.Items.Clear();
    combobox_mittwoch.Items.Clear();
    combobox_donnerstag.Items.Clear();
    combobox_freitag.Items.Clear();
    combobox_samstag.Items.Clear();
    combobox_sonntag.Items.Clear();
    listbox_items.Items.Clear();
    foreach (object item in Properties.Settings.Default.myList)
    {
        combobox_montag.Items.Add(item);
        combobox_dienstag.Items.Add(item);
        combobox_mittwoch.Items.Add(item);
        combobox_donnerstag.Items.Add(item);
        combobox_freitag.Items.Add(item);
        combobox_samstag.Items.Add(item);
        combobox_sonntag.Items.Add(item);
        listbox_items.Items.Add(item);
    }
}
The error comes here with a 'System.NullReferenceException' 'Planer.Properties.Settings.myList.get returned null.':
foreach (object item in listbox_items.Items)
{
    Properties.Settings.Default.myList.Add(item);  <---------
}
 
    