RichTextBox Control

Loading and saving files

You can load and save files in 2 different formats; RTF and Plain Text. To load a file use the following syntax:

RichTextBox1.LoadFile FilePath, Format

Where format is either the constant rtfRTF (Rich Text Format) or rtfText (Plain Text).

RichTextBox1.LoadFile "C:Document1.rtf", rtfRTF

Loads C:Document1.rtf into RichTextBox1 in RTF

To Save a file use the following syntax:

RichTextBox1.SaveFile FilePath, Format

So

RichTextBox1.SaveFile RichTextBox1.Filename, rtfRTF

This saves the current file in RTF. RichTextBox1.Filename stores the current files path.

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“XML is like violence - if it's not working for you, you're not using enough of it.”