Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a vb6 project which needs to access data in the sql database behind Business Contact Manager 2007.
In one of the tables there is a binary field called compressedrtf. It contains what you see in BCM when you view a history item.

How can I access that data and show it in a vb6 rich text box?
I think I need the adodb.stream object but am totally stuck and have spent many days trying to crack this.
Posted
Updated 7-Oct-15 3:02am
v2
Comments
Kornfeld Eliyahu Peter 7-Oct-15 9:20am    
Can you put a not compressed RTF text into the RichTextBox control?

1 solution

The RichTextBox control seems to be fine.
My problem is when I stream the binary data out of the database it appears not to be in RTF format.

I have tried 2 different approaches where txt is a variant , lrs is an adodb.recordset object and RTBbdt is the RichTextBox control

1
Set mStream = New ADODB.Stream
mStream.Type = adTypeText
mStream.Open
mStream.WriteText lrs("compressedrichtext")
mStream.SaveToFile "tmprtf.txt", adSaveCreateOverWrite
RTBbdt.FileName = "tmprtf.txt"

and
2
txt = lrs("compressedrichtext")
Set mStream = New ADODB.Stream
mStream.Type = adTypeText
mStream.Open
mStream.WriteText lrs("compressedrichtext")
mStream.SaveToFile "tmprtf.txt", adSaveCreateOverWrite
RTBbdt.Text = txt


Both just show garbled text in the rich text box.
 
Share this answer
 
Comments
CHill60 7-Oct-15 10:30am    
By posting this a solution you have marked your question as Resolved and it will no longer appear in the list of unanswered questions.
Use the Improve question link to add this information to your original question and be sure to highlight each block of code and format it using the links at the top of the editor. I would advise you to then delete this solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900