James Buttler
James Buttler

Reputation: 61

Assign a string to a RichTextBox in C#

I am trying to input a predefined string into a RichTextBox during the process of a method, e.g.:

"various words" = RichTextBox1,ToString;

How can this be done?

Upvotes: 0

Views: 375

Answers (1)

You need to modify the Text property.

Example:

RichTextBox1.Text = "various words";

If you need the text to be richly formatted, you need the Rtf property instead.

Example:

RichTextBox1.Rtf = @"{\rtf1\ansi Hello in \b bold-face \b0 .}";

Upvotes: 2

Related Questions