hello, i´m tryin to save the content of a richtextbox in a new file using a function in c sharp similar to visual basic getfile() function, basically i need to save the content of a richtextbox in a new file and then if the user wants recall this file, can you hekp me what function i need to use?
trhanks
How to save the content of a richtextbox in a new file
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted May 14, 2007, 11:37 AM EDT
From MSDN:
[C#]
public void CreateMyRichTextBox()
{
RichTextBox richTextBox1 = new RichTextBox();
richTextBox1.Dock = DockStyle.Fill;
richTextBox1.LoadFile("C:\\MyDocument.rtf");
richTextBox1.Find("Text", RichTextBoxFinds.MatchCase);
richTextBox1.SelectionFont = new Font("Verdana", 12, FontStyle.Bold);
richTextBox1.SelectionColor = Color.Red;
richTextBox1.SaveFile("C:\\MyDocument.rtf", RichTextBoxStreamType.RichText);
this.Controls.Add(richTextBox1);
}