In this step you will load a rich text file (RTF) into your project as the main body of your text editor. To load a RTF for editing, complete the following steps:
Add the following code to the Form.Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.RichTextBox1.LoadFile("C:\MyFile.rtf") |
To write code in C#
C# |
Copy Code
|
---|---|
this.richTextBox1.LoadFile(@"C:\MyFile.rtf"); |
Note that you will have to change file path to match a file path on your machine. You may load any RTF file to use for editing.
Now that you have added the RTF for editing, you can run the application and explore the run-time interaction in the last step of the quick start.