Home All Groups Group Topic Archive Search About
Author
17 Oct 2005 2:03 PM
vul
I was wondering if it's possible to save the contents of the Rich Text Box
control in the Text type of field in SQL Server table?
I know how to save the contents of RTB in a file and then open that file in
RTB for display. I wouldn't want to use files. I'd like to save the text
with formatting in a database.
For instance there is a way to save some data in db with html tags and then
display that data with formatting in Internet Explorer.
How about similar approach for RTB?

Thank you
Al

Author
17 Oct 2005 2:12 PM
Rick Rothstein [MVP - Visual Basic]
> I was wondering if it's possible to save the contents of the
Rich Text Box
> control in the Text type of field in SQL Server table?
> I know how to save the contents of RTB in a file and then open
that file in
> RTB for display. I wouldn't want to use files. I'd like to save
the text
> with formatting in a database.
> For instance there is a way to save some data in db with html
tags and then
> display that data with formatting in Internet Explorer.
> How about similar approach for RTB?

I'm not a database person myself, so this may not apply...

The RichTextBox control has a TextRTF property which contains the
Rich Text formatted text in it... can you use that in your
assignment to the SQL Server table? If not, can the Text field of
an SQL Server table even hold formatted data or is it just a plain
text kind of thing?

Rick
Author
17 Oct 2005 2:43 PM
Jeff Johnson [MVP: VB]
"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net>
wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl...

> I'm not a database person myself, so this may not apply...
>
> The RichTextBox control has a TextRTF property which contains the
> Rich Text formatted text in it... can you use that in your
> assignment to the SQL Server table?

Yes, that will work. RTF is nothing more than text, just like HTML.
Author
17 Oct 2005 3:09 PM
Rick Rothstein [MVP - Visual Basic]
"Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message
news:Op0mqky0FHA.560@TK2MSFTNGP12.phx.gbl...
>
> "Rick Rothstein [MVP - Visual Basic]"
<rickNOSPAMnews@NOSPAMcomcast.net>
> wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl...
>
> > I'm not a database person myself, so this may not apply...
> >
> > The RichTextBox control has a TextRTF property which contains
the
> > Rich Text formatted text in it... can you use that in your
> > assignment to the SQL Server table?
>
> Yes, that will work. RTF is nothing more than text, just like
HTML.

Yes, I know that RTF is just text and could be assigned to the
table cell(s); but what I wasn't sure of was whether it would hold
its formatting (bolds, italics, colors, etc.) after the
assignment.

Rick
Author
17 Oct 2005 4:00 PM
Dave
No problems, the only control character in RTF is the curly brace, there is
nothing ASCII>127 in RTF control codes.

The only worry I see is that it will need to be in a Memo field as exceeding
255 chars could easily happen.
If the user wants to search on this data he might consider storing the RTF
in a memo field and the plain text in  normal string field(s) and search
only on the plain text.

Regards
Dave O.

Show quoteHide quote
"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net>
wrote in message news:uKtk1yy0FHA.3000@TK2MSFTNGP12.phx.gbl...
>
> "Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message
> news:Op0mqky0FHA.560@TK2MSFTNGP12.phx.gbl...
>>
>> "Rick Rothstein [MVP - Visual Basic]"
> <rickNOSPAMnews@NOSPAMcomcast.net>
>> wrote in message news:OLCiLTy0FHA.712@TK2MSFTNGP10.phx.gbl...
>>
>> > I'm not a database person myself, so this may not apply...
>> >
>> > The RichTextBox control has a TextRTF property which contains
> the
>> > Rich Text formatted text in it... can you use that in your
>> > assignment to the SQL Server table?
>>
>> Yes, that will work. RTF is nothing more than text, just like
> HTML.
>
> Yes, I know that RTF is just text and could be assigned to the
> table cell(s); but what I wasn't sure of was whether it would hold
> its formatting (bolds, italics, colors, etc.) after the
> assignment.
>
> Rick
>
>
Author
17 Oct 2005 6:03 PM
Jeff Johnson [MVP: VB]
"Dave" <nob***@nowhere.com> wrote in message
news:Oeeq3Pz0FHA.3256@TK2MSFTNGP09.phx.gbl...

> No problems, the only control character in RTF is the curly brace, there
> is nothing ASCII>127 in RTF control codes.

Actually, the backslash is the main control character. Braces are only for
grouping/scoping.
Author
17 Oct 2005 4:08 PM
Jeff Johnson [MVP: VB]
"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net>
wrote in message news:uKtk1yy0FHA.3000@TK2MSFTNGP12.phx.gbl...

>> Yes, that will work. RTF is nothing more than text, just like
> HTML.
>
> Yes, I know that RTF is just text and could be assigned to the
> table cell(s); but what I wasn't sure of was whether it would hold
> its formatting (bolds, italics, colors, etc.) after the
> assignment.

No, I mean the formatting itself is just text. Much like HTML formatting is
simply <B>, <I>, etc., RTF uses escaped text to indicate formatting.
Author
17 Oct 2005 4:26 PM
Rick Rothstein [MVP - Visual Basic]
> >> Yes, that will work. RTF is nothing more than text, just like
> > HTML.
> >
> > Yes, I know that RTF is just text and could be assigned to the
> > table cell(s); but what I wasn't sure of was whether it would
hold
> > its formatting (bolds, italics, colors, etc.) after the
> > assignment.
>
> No, I mean the formatting itself is just text. Much like HTML
formatting is
> simply <B>, <I>, etc., RTF uses escaped text to indicate
formatting.

Ah! I see... he just wants to store it for future retrieval.

Rick
Author
17 Oct 2005 4:20 PM
vul
Rick, Jeff, Dave
Thanks a lot gentlemen.
It works great. I'm talking about TextRTF property. Everything else is not
important. Using this property I can save to db and retrieve the text with
formatting. Everything I wanted.

Al
Show quoteHide quote
"vul" <a**@optonline.net> wrote in message
news:ehoxdOy0FHA.700@TK2MSFTNGP10.phx.gbl...
> I was wondering if it's possible to save the contents of the Rich Text Box
> control in the Text type of field in SQL Server table?
> I know how to save the contents of RTB in a file and then open that file
in
> RTB for display. I wouldn't want to use files. I'd like to save the text
> with formatting in a database.
> For instance there is a way to save some data in db with html tags and
then
> display that data with formatting in Internet Explorer.
> How about similar approach for RTB?
>
> Thank you
> Al
>
>