Click here to Skip to main content
11,635,098 members (76,358 online)
Click here to Skip to main content

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

, 2 Nov 2006 CPOL 127.4K 6.3K 75
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

Introduction

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
    messagebox.show(r2h.html)
  End Sub

History

  • Initial release - 11/02/2006.

License

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

Share

About the Author

George H. Slaterpryce III
Architect
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

 
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
Member 1128637821-Dec-14 2:52
memberMember 1128637821-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 vb.net Pin
epit2429-Sep-11 17:04
memberepit2429-Sep-11 17:04 
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 
GeneralRe: A little bug? Pin
98z2817-Aug-11 9:18
member98z2817-Aug-11 9:18 
GeneralRe: A little bug? Pin
Johnnyasdf10-Sep-11 13:54
memberJohnnyasdf10-Sep-11 13:54 
QuestionConversion of text in textbox to HTML file Pin
AdarshPatil25-Nov-10 19:35
memberAdarshPatil25-Nov-10 19:35 
GeneralUnderline Pin
kheonline6-Oct-10 4:30
memberkheonline6-Oct-10 4:30 
QuestionCombined with RTBExVB Pin
bigbro_19858-Aug-10 20:29
memberbigbro_19858-Aug-10 20:29 
AnswerRe: Combined with RTBExVB Pin
George H. Slaterpryce III3-Sep-10 9:57
memberGeorge H. Slaterpryce III3-Sep-10 9:57 
AnswerRe: Combined with RTBExVB Pin
Member 1128637821-Dec-14 2:57
memberMember 1128637821-Dec-14 2:57 
GeneralCode for changing the Font and the FontSize with ListBox Pin
vb_newsbie12-Jul-10 21:14
membervb_newsbie12-Jul-10 21:14 
GeneralRe: Code for changing the Font and the FontSize with ListBox Pin
vb_newsbie14-Jul-10 0:16
membervb_newsbie14-Jul-10 0:16 
GeneralHi George Slaterpryce III Pin
Curtis Underwood17-May-10 6:38
memberCurtis Underwood17-May-10 6:38 
GeneralRe: Hi George Slaterpryce III Pin
George H. Slaterpryce III3-Sep-10 9:58
memberGeorge H. Slaterpryce III3-Sep-10 9:58 
GeneralNice Article Pin
jayeshshah8-Dec-09 16:55
memberjayeshshah8-Dec-09 16:55 
GeneralBugs Pin
hristo14220-Apr-09 21:55
memberhristo14220-Apr-09 21:55 
GeneralRe: Bugs Pin
Sorwen30-Apr-09 6:59
memberSorwen30-Apr-09 6:59 
GeneralRe: Bugs Pin
joseph_man6-May-09 4:02
memberjoseph_man6-May-09 4:02 
GeneralRe: Bugs Pin
Sorwen5-Jun-09 17:03
memberSorwen5-Jun-09 17:03 
GeneralRe: Bugs Pin
DjBepy15-Jul-09 2:22
memberDjBepy15-Jul-09 2:22 
GeneralRe: Bugs Pin
wouterdebo3-Feb-10 22:10
memberwouterdebo3-Feb-10 22:10 
GeneralRe: Bugs Pin
Sorwen4-Feb-10 11:30
memberSorwen4-Feb-10 11:30 
AnswerRe: Bugs Pin
amitk86-Dec-10 10:42
memberamitk86-Dec-10 10:42 
Generalhi Pin
mwau25-Feb-09 23:01
membermwau25-Feb-09 23:01 
GeneralNot saving any image Pin
suis11-Feb-09 6:40
membersuis11-Feb-09 6:40 
GeneralHey.. good one .. Pin
Abhishek sur27-Aug-08 22:00
memberAbhishek sur27-Aug-08 22:00 
Generalsaving the converted file Pin
quioske9-May-08 3:57
memberquioske9-May-08 3:57 
GeneralNice Pin
GlimmerMan6-Aug-07 3:09
memberGlimmerMan6-Aug-07 3:09 
Generalescape characters Pin
gary73-Aug-07 10:52
membergary73-Aug-07 10:52 
GeneralUnderline Pin
frederic.robert29-May-07 5:02
memberfrederic.robert29-May-07 5:02 

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

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

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