What is the benefit of using a RichTextBox over a TextBox?

BigBug picture BigBug · Dec 23, 2011 · Viewed 10.8k times · Source

After doing a bit of digging i found some (minor - in my opinion) added benefits in using a RichTextBox. For instance, it is able to detect URLs.

What are the major benefits of using a RichTextBox over just using a TextBox?

Any input would be great.

FYI: (This is purely to help me make a better decision when programming as to which one i should use. Often i simply arbitrarily pick one. However, i want to make a more well thought-out decision)

Answer

Andreas Eriksson picture Andreas Eriksson · Dec 23, 2011

Well, for example you can select a portion of the text and change its font, size, weight, etc in a RichTextBox. You can also insert inline images in an RTB. Just generally more advanced text-formatting capabilities than a normal textbox. Also, the TextBox has a 64k character limit, a limit that RTB is not affected by.

The text in a normal TextBox is just that, just text, without any additional data, with the only formatting being done with a combination of linebreaks, tabs and spaces, whereas the RichText-format has inline markup to allow for its advanced formatting capabilities. Of course, this comes at the price of larger files (proportional to the amount of markup you're using), and the fact that opening the file in an editor that can't parse RTF will result in the markup being visible.

For comparison, consider the Windows Notepad (TextBox) versus WordPad (RichTextBox).