title: Saving files with name read from text box. C#
body: <p>I have created some code that saves my work to a text file, I was just wondering is there some way so that when I click 'Save' I can read in the text from <code>richTextBox1</code>and set it as the default file name, still with the 'txt' default file extension. </p>
  
  <p>e.g. When I click 'save' the folder dialog comes up and asks you to name your file, just as it would if you were using Word for example, I want that box to already have the text from my richTextBox1 in.</p>
  
  <p>Thanks.</p>
  
  <pre><code>private void saveToolStripMenuItem_Click(object sender, EventArgs e)
      {
          SaveFileDialog save = new SaveFileDialog();
          save.InitialDirectory = "C:\\To-Do-List";
          save.Filter = "Text Files (*.txt)|*.txt";
          save.DefaultExt = ".txt";
  
  
          DialogResult result = save.ShowDialog();
  
          if (result == DialogResult.OK)
          {
              using (StreamWriter SW = new StreamWriter(save.FileName))
              {
                  SW.WriteLine(richTextBox1.Text);
                  SW.WriteLine(richTextBox2.Text);
                  SW.WriteLine(richTextBox3.Text);
                  SW.WriteLine(richTextBox4.Text);
                  SW.WriteLine(richTextBox5.Text);
                  SW.Close();
              }
  
          }
  </code></pre>