Windows Forms: How to read .rtf file in C#
By FoxLearn 7/11/2017 8:27:09 PM 5.12K
How to read rich text format (*.rtf) file using RichTextBox in c#
Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "ReadRtfFile" and then click OK
Step 2: Design your form as below
Step 3: Add code to button click event handler as below
//Open file dialog, allows you to select a rtf file private void btnOpen_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Rich Text Format|*.rtf", ValidateNames = true, Multiselect = false }) { if (ofd.ShowDialog() == DialogResult.OK) richTextBox.LoadFile(ofd.FileName); } }
VIDEO TUTORIALS
- Windows Forms: Youtube Search with Paging in C#
- Windows Forms: Text to speech in C#
- Windows Forms: Print Picture Box in C#
- Windows Forms: Advanced Filter DataGridView in C#
- Windows Forms: Progress Bar in C#
- How to create a Lucky Draw games in C#
- Windows Forms: How to Create a Random Password Generator in C#
- Windows Forms: Tag Control in C#
Categories
Popular Posts
Visual Studio: Auto increment version
04/01/2024
What is ARM architecture?
04/01/2024
What Are RESTful Web Services?
02/19/2024