Saving listbox items to file
<p>I am trying to save the items from a listbox to a file. So I started writing this code:</p>

<pre><code>private void mstri_SaveLog_Click(object sender, EventArgs e)
{
  Stream s;
  this.sfd_Log.Filter = "Textfiles (*.txt)|*.txt";
  DialogResult d = this.sfd_Log.ShowDialog();
  if ((d == DialogResult.OK) &amp;&amp; (this.lb_Log.Items.Count != 0))
  {
      for (int i = 0; i &lt; this.lb_Log.Items.Count; i++)
      {
          if ((s = this.sfd_Log.OpenFile()) != null)
          {
              StreamWriter wText = new StreamWriter(s);
              wText.Write(this.lb_Log.Items[i]);
              s.Close();
          } 
      }
  }
} 
</code></pre>

<p>There is a new textfile that is created, but it is <strong>always empty</strong>. But I have no idea where there is a mistake in my code.</p>

<p>Thank you for your help.</p>
