How can I display the formatted text from an Access memo field in my VB6 app?

thorpey83 used Ask the Experts™
I need to be able to display the formattde text from an Access 2003 memo field in my VB6 app. The richtextbox displayes it as per the example below. I tried copying and pasting the memo field contents into wordpad and then saving it as an rtf file. If I then load this file into RichTextBox it displays correctly! I need a way of copying and pasting the memo filed contents into an rtf file then all will work for me! Can anyone help me with this?
The memo field contents are below as an example(unformatted):

<div><font face="Comic Sans MS" size=1 color=black><strong>cavity brick</strong> </font></div>

<div><font face="Comic Sans MS" size=1 color=black>? outer leaf 90-110mm, inner leaf 90-110mm</font></div>

<div><font face="Comic Sans MS" size=1 color=black>? cavity 40-75mm</font></div>



Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
you will need to use a RichTextBox control, not the normal TextBox control.
Ok, did not read your post completely.  I quess the problem is that what you have is HTML, not 'rich text'.  The HTML will need a WebBrowser control on your form.


Thanks Arthur. I have loaded a Webbrowser to my app but can't seem to find a way of simply loading the memo filed contents into it! Can you please help me with this?


Hi again Arthur,
I have discovered somehting else......if I open the Access DB, highlight the formattde text in the memo field, copy it to the clipboard, then paste it into the richtextbox, all is good. I try to copy & paste using VB6 with the clipboard gettext and settext methods, and the text is pated unformatted!
Can someone help me with this?
Have you tried without clipboard?
RichTextBox1.TextRTF = memoField

Sample code for Clipboard RTF:

Option Explicit
Private Sub Form_Load()
   Dim sRTF As String
   sRTF = "{\rtf1\ansi\deff0{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset0 MS Sans Serif;}}"
   sRTF = sRTF & "\viewkind4\uc1\pard\lang1046\f0\fs20 One \b\fs24 Two\b0\fs20  \ul Three\ulnone  \i Four\lang1033\i0\f1\fs17"
    sRTF = sRTF & "\par }"
   Clipboard.SetText sRTF, vbCFRTF
   RichTextBox1.TextRTF = Clipboard.GetText(vbCFRTF)
End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial