Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAVE BOLD & FONT COLOR IN RICHTEXTBOX?

Status
Not open for further replies.

bros

Programmer
Jul 14, 2000
57
MY
can save the bold & color of font to database which I use the richtext box to key the info and I want it to display what I have be set before for the font

TQ.
 
Instead of saving the text from the text property, save the text from the TextRTF property.
 
"save the bold & color of font to database"


Yes, I do the same. What you need to do is create Fields in your database table.

Example:

FontName as String
FontBold as Boolean
FontItalic as Boolean
FontUnderline as Boolean
ForeColor as String
FontSize as integer

Then when all Fields are created, Open it and just Fill it in. Example: FontName [Arial] etc.

When your program changes the color, name, bold etc., just be sure that you initialize it with your code.

You can also, however, create dummy Labels on your form and link the fields you had created to them. So when you update the fontname, color etc., it will store it in those labels as Label1.Caption which is linked to those fields you just created.

Don't forget to use the datFont.UpdateRecord function also.

Hope this helps a little more...
 
Thank strongm and mrvb50au, but if I just want certain word for BOLD only in a textbox, Can I do that?
 
So you're looking at a field of type memo that you may want certain words bold or whatever.

Then you're looking at a whole different situation here. Unfortunately, I had the same problem as I also wanted to use it in a crystal reports document type.

As far as I know, you have two choices:

1. Don't have an RTF and use your normal Text1 box which you can still format but not just a word. But still use it for the DB if you want to use reports. When using reports, you can call the formatting of the text and have it also show on the print preview. Next time you enter the program the formatting will still be their as you saved the font formatting in a separate (lets say: Fonts.mdb) file.
OR
2. Forget about the DB file and simply use the RTF box and use the (eg: txtRTFDoc.Save) function that will enable you to save all formating that you've done and even indents, bullets, etc.,

FINALLY:
If you use RTF boxes and you plan using reports, "FORGET IT". When previewing reports with formatting in that RTF, you will see strange box looking characters along with the data you entered for that field.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top