private void SaveButton_Click(object sender, EventArgs e) { try { TextRichTextBox.SaveFile(@"../../Test.rtf", RichTextBoxStreamType.RichText); MessageBox.Show("The file has been saved!"); } catch (FileNotFoundException fnfe) { MessageBox.Show(fnfe.Message); } }
private void SaveButton_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "rtf files|*.rtf"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if (TextRichTextBox.Text != "") { TextRichTextBox.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.RichText); TextRichTextBox.Clear(); MessageBox.Show("Text has been saved!"); } } }