Live Chat Icon For mobile
Live Chat Icon

How can I create and save a RTF file

Platform: WinForms| Category: RichTextBox

One way to do this is to use the RichTextBox.SaveFile method.

private void button1_Click(object sender, System.EventArgs e)
    // Create a SaveFileDialog & initialize the RTF extension 
    SaveFileDialog saveFile1 = new SaveFileDialog();
    saveFile1.DefaultExt = '*.rtf';
    saveFile1.Filter = 'RTF Files|*.rtf';

    // get a file name from the user 
    if (saveFile1.ShowDialog() == DialogResult.OK)
        // Save the RTF contents of the RichTextBox control that 
        // was dragged onto the Window Form and populated somehow 
            RichTextBoxStreamType.RichText); //use to save RTF tags in file 
        //RichTextBoxStreamType.PlainText);//use to save plain text in file 

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.