Solved

Storing DATA and Format of the Rich Text Box

Posted on 2004-08-24
3
281 Views
Last Modified: 2010-04-23
Dear Experts

I am wokring in VB.net with SQL server2000

Is there any way to store the formatting styles say Forecolor/backcolor font type/font styles which is in the rich text box , i want to store the data of the richtext box in my SQLSERVER 2000 and again when i retrieve i want to get the same formatting styles back .
Or in other words i want to save the DATA of the RICH TEXT BOX  as well its Formatting styles

Is that possible ???

Please Guide Me
0
Comment
Question by:manishkaushik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 50 total points
ID: 11889334
The formatting of text in a RTB is stored as tags much like in HTML.  You can access the data in a RTB in two basic ways:

    Dim t As String
    t = RichTextBox1.Text() ' Retrieves only the text in the RTB

    Dim rtf As String
    rtf = RichTextBox1.Rtf ' Retrieves the text in the RTB along with all formatting information

So all you need to do is store the return of RichTextBox1.Rtf in your database.  To put the data along with its formatting back into the RTB you just set the string retrieved from your database back into the Rtf property:

    RichTextBox1.Rtf = rtf ' the string retrieved from your db that you placed there before

Regards,

Idle_Mind
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…

734 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