title: How to fix ObjectDisposedException was Unhandled?
body: <p>So I'm trying to write a simple code for educational purpose that takes a string from a textbox and writes it to txt file. Every time upon pressing the button for the second time I get this error message: <a href="http://i.stack.imgur.com/ygsm1.png" rel="nofollow">Error Message</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>StreamWriter sw = new StreamWriter("somefile.txt");
      private void button1_Click(object sender, EventArgs e)
              {
                  string textBoxStuff = textBox1.Text;
                  textBox1.Text = "";
                  using (sw)
                  {
                      sw.WriteLine(textBoxStuff);
                  }
              }
  </code></pre>