[2005]RTB Save Plain Text
So, here's my predicment I've tried for a while. No dice. I'm trying to save a file in a RTB, now I've always used:
Save Code Code:
My.Computer.FileSystem.WriteAllText("C:\Test.txt", "Text", True)
The sample inside the snippets section. It always worked for normal textboxes, but I moved onto now use a RTB to highlight syntax and now I'm having problems, the files now saving line breaks as weird symbols. Any ideas?
Re: [2005]RTB Save Plain Text
The RichTextBox control has its own methods to save its contents. By default it will save RTF but you can specify plain text if you want. That said, if you save plain text then you'll lose all your markup. If that's not what you want then save as RTF.
Re: [2005]RTB Save Plain Text
Err I should have been more specfic, using SaveFile,PlainText or whatever it is, it still leavs these annyoing little squares wherever a line break should be!
When opened in Notepad that is,
Re: [2005]RTB Save Plain Text
What jmc was suggesting in code form:
Code:
RichTextBox1.SaveFile(IO.File.CreateText("C:\test.txt").BaseStream, RichTextBoxStreamType.PlainText)