Carol Coolidge
Carol Coolidge

Reputation: 11

How can I create a newline in a rich textbox for C#?

I am making an application that displays some useful tags for HTML. The problem is, I want to make each tag and use have its own line. However, nothing seems to be working. I have tried Environment.Newline and I have also tried \n\n but neither of those do anything. I've looked everywhere for an answer but I haven't gotten any. Any help would be appreciated.

Upvotes: 0

Views: 37

Answers (1)

Frecklefoot
Frecklefoot

Reputation: 1692

You can do it in two ways:

myRichTextBox.Text += Environment.NewLine + "My new line.";

// Or

myRichTextBox.AppendText( Environment.NewLine + "My new line." );

I saw the answer here, and it goes into more discussion.

Upvotes: 1

Related Questions