Click here to Skip to main content
15,881,812 members
Articles / Web Development / HTML
Article

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

Rate me:
Please Sign up or sign in to vote.
4.55/5 (31 votes)
2 Nov 2006CPOL 213.8K   10.2K   78   61
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).

VB
''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)


Written By
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#.

Comments and Discussions

 
GeneralNice Pin
karenpayne6-Aug-07 3:09
karenpayne6-Aug-07 3:09 
Generalescape characters Pin
gary73-Aug-07 10:52
gary73-Aug-07 10:52 
GeneralUnderline Pin
frederic.robert29-May-07 5:02
frederic.robert29-May-07 5:02 
GeneralRe: Underline Pin
George H. Slaterpryce III18-Jul-07 13:29
George H. Slaterpryce III18-Jul-07 13:29 
GeneralRe: Underline Pin
Member 1392768115-Aug-19 23:33
Member 1392768115-Aug-19 23:33 
GeneralGreat work Pin
Kaushal Mca16-May-07 2:23
Kaushal Mca16-May-07 2:23 
GeneralBullets Pin
craver8413-May-07 0:57
craver8413-May-07 0:57 
GeneralRe: Bullets Pin
bigbro_19859-Aug-10 0:54
professionalbigbro_19859-Aug-10 0:54 
Generalrtf2HTML - Example Source code Pin
Rajesh Moriyani2-Jan-07 1:59
Rajesh Moriyani2-Jan-07 1:59 
GeneralHTML word Pin
pablleaf3-Nov-06 7:21
pablleaf3-Nov-06 7:21 
GeneralRe: HTML word Pin
George H. Slaterpryce III3-Nov-06 7:24
George H. Slaterpryce III3-Nov-06 7:24 

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.