Convert Text to RichText

Posted on 2005-05-11
Last Modified: 2010-05-18
Anyone have an idea of how to convert Text to RichText? I'm using the VB.Net RichText control to display and save Text in a SQL Server Database. The text needs to be converted and saved as RichText.  Right now, I set the RichTextBox control to the value from the Database but it doesn't display becuase it doesn't have the RTF markup codes.
Question by:onyak
    LVL 25

    Expert Comment


    Author Comment

    It's nvarchar.  And it's stored as Text and RichText.  What I need to do is...over time...has the application automatically convert all text to RichText by converting the text to Richtext in the application....unless it's already richtext.

    The link you posted did not have the solution.

    Author Comment

    Found a solution, but it's not the best solution...

                            rtb.Rtf = rt
                            rtb.Rtf = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033" & _
                                    "{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\" & _
                                    "pard\f0\fs17 " & rt.ToString & "\par}"
                        End Try

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now