Link to home
Start Free TrialLog in
Avatar of onyak
onyak

asked on

Convert Text to RichText

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.
Avatar of RonaldBiemans
RonaldBiemans

Avatar of onyak

ASKER

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.
Avatar of onyak

ASKER

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

                    Try
                        rtb.Rtf = rt
                    Catch
                        rtb.Rtf = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033" & _
                                "{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\" & _
                                "pard\f0\fs17 " & rt.ToString & "\par}"
                    End Try
ASKER CERTIFIED SOLUTION
Avatar of PAQ_Man
PAQ_Man
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial