Export (0) Print
Expand All
Expand Minimize

Code: Formatting Characters in Bold in a RichTextBox Control (Visual C#)

Visual Studio .NET 2003

This example adds the text "This text is in bold." to an existing RichTextBox control.


richTextBox1.Rtf = @"{\rtf1\ansi This is in \b bold\b0.}";

Compiling the Code

This example requires:

  • A RichTextBox control named richTextBox1.

Robust Programming

The rich text format is extremely flexible, but any errors in the format lead to errors in the displayed text. For more information, see Rich Text Format (RTF) Specification, version 1.6.

See Also

Windows Forms Example Topics | RichTextBox Control (Windows Forms)

© 2014 Microsoft