Loads a specific type of file into the System.Windows.Forms.RichTextBox control.
- path
- The name and location of the file to load into the control.
- fileType
- One of the System.Windows.Forms.RichTextBoxStreamType values.
When loading a file with the RichTextBox.LoadFile(string) method, the contents of the file being loaded replace the entire contents of the System.Windows.Forms.RichTextBox control. This will cause the values of the TextBoxBase.Text and RichTextBox.Rtf properties to change. You can use this method to load a previously created text or rich text format (RTF) document into the control for manipulation. If you want to save the file, you can use the RichTextBox.SaveFile(string) method.
You can use this version of the RichTextBox.LoadFile(string) method to specify the file type of the file being loaded. This feature enables you to load files other than RTF documents into the control.
The RichTextBox.LoadFile(string) method will not open a file until a handle is created for the System.Windows.Forms.RichTextBox. Ensure that the control's handle is created before calling the RichTextBox.LoadFile(string) method.