We help IT Professionals succeed at work.

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

Medium Priority
Last Modified: 2013-11-27
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.)

Watch Question

Jorge PaulinoIT Pro/Developer
Top Expert 2008

You just need to use a richtextbox control and then save as rtf like this:


Open in new window


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?
IT Pro/Developer
Top Expert 2008
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.