Click here to Skip to main content
15,313,293 members
Articles / Web Development / HTML
Posted 2 Nov 2006


77 bookmarked

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

Rate me:
Please Sign up or sign in to vote.
4.52/5 (30 votes)
2 Nov 2006CPOL
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#.

Comments and Discussions

PraiseYou making my day! Pin
mumtaz6417-May-16 0:59
Membermumtaz6417-May-16 0:59 
Suggestionjust a superscript update Pin
Member 231670319-Dec-14 22:19
MemberMember 231670319-Dec-14 22:19 
GeneralMy vote of 3 Pin
hepter3-Jan-14 23:32
Memberhepter3-Jan-14 23:32 
QuestionAre you kidding me!? Pin
Fuck you assholes30-Jul-12 5:09
MemberFuck you assholes30-Jul-12 5:09 
AnswerRe: Are you kidding me!? Pin
George H. Slaterpryce III30-Jul-12 10:07
MemberGeorge H. Slaterpryce III30-Jul-12 10:07 
Questionc# Pin
Jheiron29-Jun-12 7:51
MemberJheiron29-Jun-12 7:51 
AnswerRe: c# Pin
George H. Slaterpryce III30-Jul-12 10:08
MemberGeorge H. Slaterpryce III30-Jul-12 10:08 
Questionhow can I use with Strike tag? Pin
kals8420-Dec-11 1:53
Memberkals8420-Dec-11 1:53 
QuestionNew Release Pin
George H. Slaterpryce III5-Dec-11 21:18
MemberGeorge H. Slaterpryce III5-Dec-11 21:18 
AnswerRe: New Release Pin
Chitation4-Jan-12 11:31
MemberChitation4-Jan-12 11:31 
AnswerRe: New Release Pin
98z2831-Mar-12 11:35
Member98z2831-Mar-12 11:35 
AnswerRe: New Release Pin
simon Barnby9-Aug-12 22:00
Membersimon Barnby9-Aug-12 22:00 
AnswerRe: New Release Pin
dotnetme227-Sep-13 5:28
Memberdotnetme227-Sep-13 5:28 
AnswerRe: New Release Pin
ajdjnfdfd21-Dec-14 2:52
Memberajdjnfdfd21-Dec-14 2:52 
AnswerRe: New Release Pin
Robert Gustafson3-Jul-15 11:36
MemberRobert Gustafson3-Jul-15 11:36 
GeneralRe: New Release Pin
George H. Slaterpryce III6-Jul-15 9:17
MemberGeorge H. Slaterpryce III6-Jul-15 9:17 
GeneralRe: New Release Pin
Robert Gustafson16-Jul-15 16:45
MemberRobert Gustafson16-Jul-15 16:45 
GeneralRe: New Release Pin
George H. Slaterpryce III17-Jul-15 9:08
MemberGeorge H. Slaterpryce III17-Jul-15 9:08 
Answervery nice code & good readers hint. Pin
nasimb16-Nov-11 3:00
Membernasimb16-Nov-11 3:00 
Questiondisplay html format in Pin
epit2429-Sep-11 17:04
Memberepit2429-Sep-11 17:04 
AnswerRe: display html format in Pin
Member 139276811-Jul-19 1:24
MemberMember 139276811-Jul-19 1:24 
QuestionFix for .NET4 and VS2010 Pin
Johnnyasdf11-Sep-11 12:36
MemberJohnnyasdf11-Sep-11 12:36 
AnswerRe: Fix for .NET4 and VS2010 Pin
Member 945127426-Apr-14 2:29
MemberMember 945127426-Apr-14 2:29 
BugA little bug? Pin
98z2813-Aug-11 8:38
Member98z2813-Aug-11 8:38 
GeneralRe: A little bug? Pin
George H. Slaterpryce III15-Aug-11 16:31
MemberGeorge H. Slaterpryce III15-Aug-11 16:31 

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.