Remulac
asked on
Unwanted Codes in Rich Text Boxes
I've written a VB 6.0 program that uses the Rich Text Box tool to display large blocks of text. Sometimes I'll save a recording using one of these text boxes, and the next time I open it, there are all these codes mixed in with the text like this for example:
{\rtf1\ansi\deff0{\fonttbl {\f0\fnil\ fcharset0 MS Sans Serif;}}
Needless to say, it makes the text hard to read. How can I prevent this from happening? Also, is there any way I can cut out blocks that have been "polluted" by the codes and strip to codes out so I can save them clean?
Thanks in advance for any help you can give me.
{\rtf1\ansi\deff0{\fonttbl
Needless to say, it makes the text hard to read. How can I prevent this from happening? Also, is there any way I can cut out blocks that have been "polluted" by the codes and strip to codes out so I can save them clean?
Thanks in advance for any help you can give me.
If you are using the .savefile command with rich text box add a 1 at the end:
RichTextBox1.SaveFile "myfilename.txt", 1
-Jeff
RichTextBox1.SaveFile "myfilename.txt", 1
-Jeff
I was going to sugggest the converse:
RichTextBox1.SaveFile "yourfilepath&name.txt", rtfText ' rtfText = 1; the default is 0 (rtfRTF)
RichTextBox1.SaveFile "yourfilepath&name.txt", rtfText ' rtfText = 1; the default is 0 (rtfRTF)
But be carefull - You are going to lose any formating like diferent fonts, colors, sizes etc. if you will save your .RTF file as regular text
Is this what are you want?
Is this what are you want?
ASKER
I should have mentioned that I'm saving this to an Access database using ADO, so I don't know if any of the tricks listed above will help me out.
As far as losing formatting; I'd like to keep indents and what-not, but if that's not possible, I guess it's worth it to lose all those foreign characters.
As far as losing formatting; I'd like to keep indents and what-not, but if that's not possible, I guess it's worth it to lose all those foreign characters.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why are you using the rich text box control(i guess you are not using any formatting in the text box)...you can use text box and change it to multiline and scroll bar set to vertical....
rinks
rinks
RichTextBox1.TextRTF <--- For RichTextFile Format
RichTextBox1.Text <--- Text Format
Example : i write world "HelloWolrd" in RichTextBox
when you use .TextRTF property it will reture
{\rtf1\ansi\ansicpg1252\de ff0{\fontt bl{\f0\fni l\fcharset 0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang10 33\f0\fs17 HelloWorld
\par }
if you use .Text property it will reture
HelloWorld
RichTextBox1.Text <--- Text Format
Example : i write world "HelloWolrd" in RichTextBox
when you use .TextRTF property it will reture
{\rtf1\ansi\ansicpg1252\de
\viewkind4\uc1\pard\lang10
\par }
if you use .Text property it will reture
HelloWorld
I Recomend accept last post of aParser as an answer
ASKER
Sorry about that, gentlemen. I need to understand better how this site works. Where is the most concise explanation of the points system?
RichTextBox1.LoadFile "yourfilepath&name.rtf", 0
S