Click here to Skip to main content
13,355,538 members (74,227 online)
Click here to Skip to main content
Add your own
alternative version


76 bookmarked
Posted 2 Nov 2006

Using a VB.NET 2005 Class to Convert RichText to HTML

Rate this:
Please Sign up or sign in to vote.
A quick way to convert RichText to HTML.

A window showing a Rich Editor and the resutling HTML code


This code was written to solve the problem of having RichText data needing to be displayed in HTML, both in HTML reports and in ASP.NET web pages.

Using the code

Use of the code is exceptionally simple. Simply create a new instance of the class and then use the properties to first pass in the RichText to parse and then use the html property to get the resulting HTML. (The code file for the class is attached to this article).

''Assume you have a RichTextBox on your 
''form named rtbFoo and a button named btnBar

  Private Sub btnBar_Click(ByVal sender as object, _
          e as System.EventArgs) Handles btnBar.Click
    dim r2h as new RTFtoHTML
    r2h.rtf = rtbFoo.rtf
  End Sub


  • Initial release - 11/02/2006.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

George H. Slaterpryce III
United States United States
Developing software since 1995, starting out with Borland Turbo C++ 3 & Motorolla Assembly.
Eventually learning several different languages such as
Pascal/Delphi,Basic, Visual Basic,FoxPro, ASP, PHP, and Perl.

Currently using the .net framework for most development task.

Hobbies include underwater robotics, and electronics.

George's current language of choice is C#.

You may also be interested in...


Comments and Discussions

PraiseYou making my day! Pin
mumtaz6417-May-16 1:59
membermumtaz6417-May-16 1:59 
Suggestionjust a superscript update Pin
Member 231670319-Dec-14 23:19
memberMember 231670319-Dec-14 23:19 
GeneralMy vote of 3 Pin
hepter4-Jan-14 0:32
memberhepter4-Jan-14 0:32 
QuestionAre you kidding me!? Pin
Fuck you assholes30-Jul-12 6:09
memberFuck you assholes30-Jul-12 6:09 
AnswerRe: Are you kidding me!? Pin
George H. Slaterpryce III30-Jul-12 11:07
memberGeorge H. Slaterpryce III30-Jul-12 11:07 
Questionc# Pin
Jheiron29-Jun-12 8:51
memberJheiron29-Jun-12 8:51 
AnswerRe: c# Pin
George H. Slaterpryce III30-Jul-12 11:08
memberGeorge H. Slaterpryce III30-Jul-12 11:08 
Questionhow can I use with Strike tag? Pin
kals8420-Dec-11 2:53
memberkals8420-Dec-11 2:53 
QuestionNew Release Pin
George H. Slaterpryce III5-Dec-11 22:18
memberGeorge H. Slaterpryce III5-Dec-11 22:18 
AnswerRe: New Release Pin
Chitation4-Jan-12 12:31
memberChitation4-Jan-12 12:31 
AnswerRe: New Release Pin
98z2831-Mar-12 12:35
member98z2831-Mar-12 12:35 
AnswerRe: New Release Pin
simon Barnby9-Aug-12 23:00
membersimon Barnby9-Aug-12 23:00 
AnswerRe: New Release Pin
dotnetme227-Sep-13 6:28
memberdotnetme227-Sep-13 6:28 
AnswerRe: New Release Pin
Member 1128637821-Dec-14 3:52
memberMember 1128637821-Dec-14 3:52 
AnswerRe: New Release Pin
Robert Gustafson3-Jul-15 12:36
memberRobert Gustafson3-Jul-15 12:36 
GeneralRe: New Release Pin
George H. Slaterpryce III6-Jul-15 10:17
memberGeorge H. Slaterpryce III6-Jul-15 10:17 
GeneralRe: New Release Pin
Robert Gustafson16-Jul-15 17:45
memberRobert Gustafson16-Jul-15 17:45 
GeneralRe: New Release Pin
George H. Slaterpryce III17-Jul-15 10:08
memberGeorge H. Slaterpryce III17-Jul-15 10:08 
Answervery nice code & good readers hint. Pin
nasimb16-Nov-11 4:00
membernasimb16-Nov-11 4:00 
Questiondisplay html format in Pin
epit2429-Sep-11 18:04
memberepit2429-Sep-11 18:04 
Dear sir,

I already can convert from richtextbox into html format.
But how i want to convert back from html format to richtextbox format?
QuestionFix for .NET4 and VS2010 Pin
Johnnyasdf11-Sep-11 13:36
memberJohnnyasdf11-Sep-11 13:36 
AnswerRe: Fix for .NET4 and VS2010 Pin
Member 945127426-Apr-14 3:29
memberMember 945127426-Apr-14 3:29 
BugA little bug? Pin
98z2813-Aug-11 9:38
member98z2813-Aug-11 9:38 
GeneralRe: A little bug? Pin
George H. Slaterpryce III15-Aug-11 17:31
memberGeorge H. Slaterpryce III15-Aug-11 17:31 
GeneralRe: A little bug? Pin
98z2817-Aug-11 10:18
member98z2817-Aug-11 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 2 Nov 2006
Article Copyright 2006 by George H. Slaterpryce III
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid