How do I write a file in RTF format using Visual Basic 2008?

I am currently developing a program using the Visual Basic component of Visual Studio 2008.

I have to produce a file in rich text format so as not to restrict it to a particular word processor such as MS Word. However, I have never done this before and have no idea how I write the file in RTF.

Can someone either describe the process or point me to some website where I can get something more descriptive than I have been able to find on the Microsoft website which, as usual, assumes a lot of knowledge?

(Normally I would have used C++ since I am much more experienced in that language but the task requires me to use VB where my experience is intermediate.)

Who is Participating?
Jorge PaulinoIT Pro/DeveloperCommented:
Yes, that's it! You just need to add the format you want to the text and save it as a rtf file.
Something like:
' bold the selection with size 12, font Arial
Me.RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)  
and then save it
Jorge PaulinoIT Pro/DeveloperCommented:
You just need to use a richtextbox control and then save as rtf like this:


Open in new window

jindaleeAuthor Commented:
I guess then that if I want, for example, to have some text bolded, different font etc, I have to write the code to do the bolding etc and the SaveFile method does the rest?
jindaleeAuthor Commented:
Thank you!

I thought that the solution would be pretty simple but couldn't see it for looking. I've already checked out your suggestion and it worked first time.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.