Technology Programming

How to Convert RTF to Plain Text in Visual Basic

    • 1). Create a new project by selecting "Create New Project" from the "File" menu. Name it whatever you like and use the default options for any dialog boxes that Visual Basic presents to you. When you have finished, you should be staring at a blank window in the Visual Basic GUI design interface.

    • 2). Find the RichTextBox component in the control list on the left-hand side of the screen, and drag it into your application window.

    • 3). Find the Button component from the control list and drag it into your application window as well. Go to the properties list on the bottom right of the screen, and change the text property of this button to "Strip RTF."

    • 4). Double-click the button. This will move you out of the GUI design interface and to the source code editor. It will also declare a function automatically for you that will be called whenever the button is pressed by a user.

    • 5). Insert the following code into the button click function:

      Private Sub Button1_Click(ByVal sender As System.Object, ByValue As System.EventArgs) Handles Button1.Click
      RichTextBox1.Rtf = {\rtf1\ansi\deff0{\colortbl;red0\green0\blue0;\red255\green0\blue0;}This line is the default color\line\cf2This line is red\line\cf1This line is the default color}

      String plaintext = RichTextBox1.Text
      End Sub

      Going line by line, this will place some RTF formatted text into the RichTextBox. It will then place the text, with its formatting stripped, into a string named plaintext. From there, you can do with it what you like.

SHARE
RELATED POSTS on "Technology"
Blitzerwarner: Could You Escape the Speed Cameras?
Blitzerwarner: Could You Escape the Speed Cameras?
What Makes a Perfect Web Design Company?
What Makes a Perfect Web Design Company?
Inside No-Fuss Products In Gaming Computers
Inside No-Fuss Products In Gaming Computers
Gaming Institute, Game Design Schools at PAI-ILS, PAI International Learning Solutions Pune
Gaming Institute, Game Design Schools at PAI-ILS, PAI International Learning Solutions Pune
Free Music Players For Websites
Free Music Players For Websites
'See How NCP Tracks Down Fake Ration Card Holders'
'See How NCP Tracks Down Fake Ration Card Holders'
You Can Stop Panic Attacks in Just two Minutes
You Can Stop Panic Attacks in Just two Minutes
WordPress Blog to WP Site! A Journey to Online Success
WordPress Blog to WP Site! A Journey to Online Success
Videos will give your business portal an extra leverage
Videos will give your business portal an extra leverage
Excellent Ways To Make Weight Loss Work For You
Excellent Ways To Make Weight Loss Work For You
Five Notable Differences between National and International Logo Designs
Five Notable Differences between National and International Logo Designs
Who Should Your Phoenix Web Design Client Be?
Who Should Your Phoenix Web Design Client Be?
White Papers & Other Documents - including ALFLB
White Papers & Other Documents - including ALFLB
Google Analytics Tips
Google Analytics Tips
Want To Make Your Website Faster? Follow These Steps
Want To Make Your Website Faster? Follow These Steps
The Starting of Couture Apparel
The Starting of Couture Apparel
Choose Custom Website Design Services
Choose Custom Website Design Services
Choosing the Right Joomla CMS Developer
Choosing the Right Joomla CMS Developer
A Look at SQL Server Denali AlwaysOn
A Look at SQL Server Denali AlwaysOn
4 Tips to Choose the Perfect Flash Animation Course
4 Tips to Choose the Perfect Flash Animation Course

Leave Your Reply

*