Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-05-13
3
Medium Priority
?
337 Views
Last Modified: 2011-10-03
Hi

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
0
Comment
Question by:Murray Brown
  • 2
3 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 16673897
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.

Fernando
0
 

Author Comment

by:Murray Brown
ID: 16680549
Thanks very much. Great answer!
0
 
LVL 64

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

810 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