Question How to save RichTextBox Formatted Text to sql server 2000

prasad kulkarni

Well-known member
Joined
Sep 7, 2009
Messages
62
Programming Experience
1-3
Hi,

I am using vb.net 2005 . In my form there is RichTextBox , when i write
particular format with bold,diffrent font,color and save to sql server 2000
database with datatype 'Text' then formatted text not save in database.
what is the way or source code to save formatted(rtf) text to databse,
and how to display/retrive formatted(rtf) text back to RichtextBox.

if any one know then please reply me soon.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,346
Location
Sydney, Australia
Programming Experience
10+
The RichTextBox has a Text property and an Rtf property. The Text property contains just the unformatted text, just like a regular TextBox. The Rtf property contains the text plus all the RTF markup. It resembles what you see when you select View Source in a web browser, although RTF markup is not the same as HTML markup.

To answer your question, you need to get the contents of the Rtf property and save that to the database and then set the Rtf property when you get the data back from the database.
 
Top Bottom