How To Add Newline in a TextBox control in C# – Programming, Pseudocode Example, C# Programming Example
C# Windows Form

How To Add Newline in a TextBox control in C#

In this tutorial, we’ll learn How to add newline in a TextBox Control.

Normally, when you want to add newline to a string you can use’\n’ for adding new lines like below.

Example:

Output: (In Message box only)

In Message box you can see the newline but not in the text box.

If you want to add newline for a text box, you can not simply use ‘\n’, rather you can use Environment.NewLine.

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.