Loads a rich text format (RTF) or standard ASCII text file into the System.Windows.Forms.RichTextBox control.
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 RTF document into the control for manipulation. If you want to save the file, you can use the RichTextBox.SaveFile(string) method.
With this version of the RichTextBox.LoadFile(string) method, if the file being loaded is not an RTF document, an exception will occur. To load a different type of file such as an ASCII text file, use the other versions of this method that accept a value from the System.Windows.Forms.RichTextBoxStreamType enumeration as a parameter.
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.