3
votes

I've seen some topics on this subject but none of them wants to work in my case. In my Windows Forms app I have a ordinary Resourcescatalog containing some images and .rtf files. It looks like this:

enter image description here

There's no problem for me to load pictures from it as:

Bitmap bmp = Properties.Resources.Cut_6523;

But, for some reason, I am unable to do the same with .rtf files (only bitmaps are available).

What am I doing wrong?

3

3 Answers

4
votes

When you store a .rft file as resource using resource designer, the resource designer creates a string property for it that returns rich text.

So you can set the content of RichTextBox to rich text using SelectedRtf property.

this.richTextBox1.SelectAll();
this.richTextBox1.SelectedRtf = Properties.Resources.YourRTFResourceName;

Also as another option, you can cache that resource as a file in your application directory at run-time and then use richTextBox1.LoadFile to load rich text.

0
votes

i don't sure it's will work for C#, i code this for .Net try to convert this code.

RichTextBox1.LoadFile(Application.StartupPath & "\user_guide.rtf")

well that's my code on "VB.NET"

0
votes

This is just the folder where your files are laying on your disk. Somewhere in your project, there is also a .resx file (probably under Properties). Open that file by a double-click and drag-drop your .rtf file from the solution explorer over the designer view of the .resxfile.