All,

I'm trying to use a RichTextBox to display the revsion history of my program, and I can't figure out how to format the text (bold, italic, etc.). I'm using the String Collection Editor in the Lines Property.

Anyone know how to do this, or if I should be using a RichTextBox in the first place?

Thanks,
Bill

Recommended Answers

All 7 Replies

Are you trying to load the info manually or automatically?
What format is the info stored in?
What code have you attempted so far?

I'm loading manually. Every time I change something I'd like to add a note describing that change so that the end users can see what was changed since the previous rev. Adding the text is no problem, I just don't know how to format it (bold etc).

I presently have working code that displays a form containing the rich text box when someone clicks Help > Revision History.

What you could do is start a .rtf file, wordpad will do. Add your changes there and populate the richtextbox from that file. Formatting probably shouldn't be too fancy, maybe the version number in bold large font and the changes, in a lighter smaller font, as a list underneath. You could even import that as an embedded resource, so that a separate file won't have to be shipped with your app.

Formatting probably shouldn't be too fancy, maybe the version number in bold large font and the changes, in a lighter smaller font, as a list underneath.

That's exactly what I want:

1.2, 01-05-2013 - B. Drago
Replaced linear interpolation with 3rd order poly fit.
Corrected spelling errors on Load menu.

1.1, 12-22-2012 - B. Drago
Added "Restore From EEPROM" feature.

What you could do is start a .rtf file, wordpad will do. Add your changes there and populate the richtextbox from that file.

How do I "populate the richtextbox from that file?" You mean just read the file and append it to the box?

You could even import that as an embedded resource, so that a separate file won't have to be shipped with your app.

Perfect, how?

Also, is that the standard way to do something like this? I don't want to re-invent the wheel.

Thanks,
-Bill

You could even import that as an embedded resource, so that a separate file won't have to be shipped with your app.

Perfect, how?

Create the file. I like to save it in the resource folder of the project, this way you can open it while in VS. Go to your project properties. Click the Resource tab and add that file.

To fill the richtextbox use richTextBox1.Rtf = Your_App.Properties.Resources.Your_Document;

Also, is that the standard way to do something like this? I don't want to re-invent the wheel.

I'm not sure sure about standard, but this way you can still update it, the file is hidden from general view, and any other way of doing it would require more coding. I don't think it can get any simpler than this.

Create the file.

Done.

I like to save it in the resource folder of the project

I don't see a "resource" folder, all I have is bin, obj, and Properties. So I made a folder called "Resources" at the same level as bin, obj etc. and put the file in it.

Go to your project properties. Click the Resource tab and add that file. To fill the richtextbox use richTextBox1.Rtf = Your_App.Properties.Resources.Your_Document;

Wow. That worked great! Thank you!!!

Did I put the resource folder in the right place?

Thanks again!
-Bill

Yes that will work. You should be able to see it in the solution explorer, you might have to enable show all files first. Please remember to mark this solved if you your happy with this. thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.