Saving Richtext

pagego

Freshman
Joined
Jan 30, 2003
Messages
27
Location
Milwaukee, WI
I have a program in which I use several writelines to save richtext strings to a .txt file in this manner:

richtext string 1
regular text string 1
richtext string 2
regular text string 2
...

However it saves like this:

rich
text
string 1
regular text string 1
rich
text
string 2
regular text string 2
...

Then it of course reloads it in this manner, one line at a time and messes with my string arrays. How can I fix this without using multiple files??

Thanks in advance for your help
 
Code:
 dim mywriter as io.streamwriter

mywriter = system.io.file.createtext(myfile)

mywriter.writeline(richtextbox.rtf)
mywriter.writeline(richtextbox.text)

The text is saved in a string array but this is basicly it. Thanks
 
Are you saying that the rtf breaks into couple lines but you want to write into a single line using WriteLine? If there are new lines in the rtf it will be carried over to the next line.
 
If the RTF is on multiple lines it will be stored as such. To remove the newlines, try this:

Visual Basic:
mywriter.writeline(richtextbox.rtf.Replace(ControlChars.CrLf, ""))
 
Back
Top