Results 1 to 4 of 4

Thread: [2005]RTB Save Plain Text

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    22

    [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:
    1. 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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    22

    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,

  4. #4
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width