Visual Studio 2005: Embedding .rtf files in your app and calling them with StreamReader

Posted on 2006-05-13
Last Modified: 2011-10-03

How do you

1) Embed .RTF files,  in your Visual Studio application, and

2) Use a StreamReader to get the file stream from the assembly manifest.

3) Load the .RTF file int5o a RichTextBox
Question by:murbro
    LVL 62

    Accepted Solution

    Hi murbro;

    To embed a rtf file into a program perform the following steps.

    1.      Place the RTF file into the Project folder, where the Form.vb file is.
    2.      In the Solution Explore window right click the assembly name.
    3.      Select Properties from the menu.
    4.      Click on Resources tab on the left side of the page.
    5.      Click on the down arrow on the button labeled Add Resources.
    6.      Click on Add Existing File.
    7.      Navigate to the location you placed the rtf file in step 1.
    8.      At the bottom of the window change the Files of Type to All Files.
    9.      Select the file to add to the resources and click on Open

    Now in code when you want to load the RTF file into the RichTextBox do the following:

    Me.RichTextBox1.Rtf = My.Resources.RTFFileNameInResource

    The above line assumes that the rich text box is called RichTextBox1 and the rich text file embeded into the code is RTFFileNameInResource.


    Author Comment

    Thanks very much. Great answer!
    LVL 62

    Expert Comment

    by:Fernando Soto
    Glad I was able to help. :=)

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now