System.Windows.Forms.RichTextBox.SaveFile Method

Saves the contents of the System.Windows.Forms.RichTextBox to a rich text format (RTF) file.

Syntax

public void SaveFile (string path)

Parameters

path
The name and location of the file to save.

Remarks

The RichTextBox.SaveFile(string) method enables you to save the entire contents of the control to an RTF file that can be used by other programs such as Microsoft Word and Windows WordPad. If the file name that is passed to the path parameter already exists at the specified directory, the file will be overwritten without notice. You can use the RichTextBox.LoadFile(string) method to load the contents of a file into the System.Windows.Forms.RichTextBox.

Note:

To save the contents of the control to a different type of file format such as ASCII text, use the other versions of this method that accept a value from the System.Windows.Forms.RichTextBoxStreamType enumeration as a parameter.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0