title: Why word in listbox line removed not just one line but 2 lines?
body: <p>I launch the program, add some words to a listbox and try to remove it. If the selected item is last one, then it works fine, but if I select a word in the middle, then it removes the selected word. Then I loaded listbox again, and the last word disappeared somewhere. Any solutions?</p>
  
  <pre><code>    public List&lt;string&gt; words = new List&lt;string&gt;();
  
      public Form2()
      {
          InitializeComponent();
          Load();
  
          listBox1.DataSource = words;
  
      }        
      public void Save()
      {
          const string sPath = "Data.txt";
          System.IO.StreamWriter sw = new System.IO.StreamWriter(sPath);
          foreach (string item in words)
          {
              sw.WriteLine(item);
          }
  
          sw.Close();
      }
      private void Load()
      {
          string line;
          var file = new System.IO.StreamReader("Data.txt");
          while ((line = file.ReadLine()) != null)
          {
              words.Add(line);
          }
      }
      // This Part ???
      private void Remove()
      {
          string contents = null;
          List&lt;string&gt; itemAll = new List&lt;string&gt;();
          foreach (string str in words)
          {
              itemAll.Add(str);
          }
          foreach (string lstitem in listBox1.SelectedItems)
          {
              itemAll.Remove(lstitem);
              //File.AppendAllText(strFile + "Currently In.txt", strName + Environment.NewLine);
          }
          foreach (string s in itemAll)
          { contents += s + Environment.NewLine; }
          System.IO.File.WriteAllText(@"Data.txt", contents);
  
      }
      private void button2_Click(object sender, EventArgs e)
      {
          // The Remove button was clicked.
          int selectedIndex = listBox1.SelectedIndex;
  
          try
          {
              // Remove the item in the List.
              words.RemoveAt(selectedIndex);
          }
          catch
          {
          }
  
          listBox1.DataSource = null;
          listBox1.DataSource = words;
          Remove();
  
      }
  </code></pre>