Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

 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

  • *Experts*
Posted
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.
  • *Experts*
Posted

If the RTF is on multiple lines it will be stored as such. To remove the newlines, try this:

 

mywriter.writeline(richtextbox.rtf.Replace(ControlChars.CrLf, ""))

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...