title: C# Save vs Save As
body: <p>Situation: You have a simple text editor and you've got the "Save As..." routine down pat with the following code:</p>
  
  <pre><code>        SaveFileDialog dlg = new SaveFileDialog();
  
          dlg.Filter = "Text Files (*.txt)|*.txt|All Files (*.*|*.*";
          dlg.AddExtension = true;
          dlg.DefaultExt = ".txt";
          dlg.FilterIndex = 1;
  
          if (dlg.ShowDialog() == DialogResult.OK)
          {
              System.IO.TextWriter w = new System.IO.StreamWriter(dlg.FileName.ToString());
  
              w.Write(textBox1.Text);
              w.Flush();
              w.Close();
  </code></pre>
  
  <p>Now you want to write a routine for "Save" as opposed to "Save As" but aren't sure how to do it. Anyone know?</p>