RichTextBoxStreamType Enumeration
Specifies the types of input and output streams used to load and save data in the RichTextBox control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Member name | Description | |
|---|---|---|
| RichText | A Rich Text Format (RTF) stream. | |
| PlainText | A plain text stream that includes spaces in places of Object Linking and Embedding (OLE) objects. | |
| RichNoOleObjs | A Rich Text Format (RTF) stream with spaces in place of OLE objects. This value is only valid for use with the SaveFile method of the RichTextBox control. | |
| TextTextOleObjs | A plain text stream with a textual representation of OLE objects. This value is only valid for use with the SaveFile method of the RichTextBox control. | |
| UnicodePlainText | A text stream that contains spaces in place of Object Linking and Embedding (OLE) objects. The text is encoded in Unicode. |
Use the members of this enumeration when calling the LoadFile and SaveFile methods of the RichTextBox control.
The following example saves the contents of the RichTextBox into an ASCII text file. The example uses the SaveFileDialog class to display a dialog to request the path and file name from the user. The code then saves the contents of the control to that file. The example uses this version of the SaveFile method to specify that the file be saved as an ASCII text file instead of the standard Rich Text Format. This example assumes that the code is placed in a Form class that has a RichTextBox control named richTextBox1.
public: void SaveMyFile() { // Create a SaveFileDialog to request a path and file name to save to. SaveFileDialog^ saveFile1 = gcnew SaveFileDialog; // Initialize the SaveFileDialog to specify the RTF extension for the file. saveFile1->DefaultExt = "*.rtf"; saveFile1->Filter = "RTF Files|*.rtf"; // Determine if the user selected a file name from the saveFileDialog. if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && saveFile1->FileName->Length > 0 ) { // Save the contents of the RichTextBox into the file. richTextBox1->SaveFile( saveFile1->FileName, RichTextBoxStreamType::PlainText ); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.