Click here to Skip to main content
12,621,191 members (35,541 online)
Click here to Skip to main content
Add your own
alternative version

Stats

143.7K views
7.3K downloads
76 bookmarked
Posted

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

, 2 Nov 2006 CPOL
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...

Pro
Pro

Comments and Discussions

 
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 
GeneralRe: A little bug? Pin
Johnnyasdf10-Sep-11 14:54
memberJohnnyasdf10-Sep-11 14:54 
GeneralRe: A little bug? Pin
gearcam1-Jul-16 7:17
membergearcam1-Jul-16 7:17 
QuestionConversion of text in textbox to HTML file Pin
AdarshPatil25-Nov-10 20:35
memberAdarshPatil25-Nov-10 20:35 
Hi All,

I have a question.

I am typing some text in textbox or richtextbox in vb.net(2003 version) and on the button click event i want a html file (its good if the output is in marquee format) to be created in a desired location which contains the text written in textbox or richtextbox.


Please can anyone helpme out!!
GeneralUnderline Pin
kheonline6-Oct-10 5:30
memberkheonline6-Oct-10 5:30 
QuestionCombined with RTBExVB Pin
bigbro_19858-Aug-10 21:29
memberbigbro_19858-Aug-10 21:29 
AnswerRe: Combined with RTBExVB Pin
George H. Slaterpryce III3-Sep-10 10:57
memberGeorge H. Slaterpryce III3-Sep-10 10:57 
AnswerRe: Combined with RTBExVB Pin
Member 1128637821-Dec-14 3:57
memberMember 1128637821-Dec-14 3:57 
GeneralCode for changing the Font and the FontSize with ListBox Pin
vb_newsbie12-Jul-10 22:14
membervb_newsbie12-Jul-10 22:14 
GeneralRe: Code for changing the Font and the FontSize with ListBox Pin
vb_newsbie14-Jul-10 1:16
membervb_newsbie14-Jul-10 1:16 
GeneralHi George Slaterpryce III Pin
Curtis Underwood17-May-10 7:38
memberCurtis Underwood17-May-10 7:38 
GeneralRe: Hi George Slaterpryce III Pin
George H. Slaterpryce III3-Sep-10 10:58
memberGeorge H. Slaterpryce III3-Sep-10 10:58 
GeneralNice Article Pin
jayeshshah8-Dec-09 17:55
memberjayeshshah8-Dec-09 17:55 
GeneralBugs Pin
hristo14220-Apr-09 22:55
memberhristo14220-Apr-09 22:55 
GeneralRe: Bugs Pin
Sorwen30-Apr-09 7:59
memberSorwen30-Apr-09 7:59 
GeneralRe: Bugs Pin
joseph_man6-May-09 5:02
memberjoseph_man6-May-09 5:02 
GeneralRe: Bugs Pin
Sorwen5-Jun-09 18:03
memberSorwen5-Jun-09 18:03 
GeneralRe: Bugs Pin
DjBepy15-Jul-09 3:22
memberDjBepy15-Jul-09 3:22 
GeneralRe: Bugs Pin
wouterdebo3-Feb-10 23:10
memberwouterdebo3-Feb-10 23:10 
GeneralRe: Bugs Pin
Sorwen4-Feb-10 12:30
memberSorwen4-Feb-10 12:30 
AnswerRe: Bugs Pin
amitk86-Dec-10 11:42
memberamitk86-Dec-10 11:42 

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.

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