When you click the save text button written in RichTextBox , the OpenFileDialog displayed. The first five words from the first line in the RichTextBox should be the name of the file when saving. How to do it?
private void buttonSave_Click(object sender, EventArgs e) { SaveFileDialog svf = new SaveFileDialog(); svf.Filter = "Text Files (.rtf)|*.rtf"; svf.Title = "Save"; if (svf.ShowDialog() == DialogResult.OK) { System.IO.StreamWriter sw = new System.IO.StreamWriter(svf.FileName); sw.Write(richTextBox1.Text); sw.Close(); } }