Results 1 to 3 of 3

Thread: [RESOLVED] [2008] Font problem in my notepad program

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    14

    Resolved [RESOLVED] [2008] Font problem in my notepad program

    I have a small problem with a notepad look-alike program... It's no problem to save the file, it creates it and all, but if I save the text file with a font, (maybe times new roman, size 72 and color blue), when I open the file, the text is blue and the font i microsoft sans serif, size 9.

    What's wrong with it? Is it the code?

    So, i tested my code in another notepad that i made really fast using a richtextbox and a regular textbox and it has the same problem!

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

    Re: [2008] Font problem in my notepad program

    You can't save a text file with a font. Text files contain plain text only, i.e. each byte represents a character and that's it. In order to store formatting information, like fonts, you would have to save to a file format that supports text formatting, e.g. RTF.

    The standard TextBox supports plain text only. It will allow you to change the colour, font, etc. of the display but that is NOT part of the data itself. If you save the contents of a TextBox then it's just the characters you're saving. That's how Notepad works too.

    The RichTextBox control supports the RTF format. RTF is similar to HTML in that the data contains tags that describe how the text should be displayed. Wjem you save the contents of a RichTextBox you're saving that formatting information too. That's how WordPad works too.
    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
    New Member
    Join Date
    Nov 2008
    Posts
    14

    Re: [RESOLVED] [2008] Font problem in my notepad program

    Thanks a lot! That solved my problem!

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