DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

C#: Inserting New Line In Multiline Textbox

08.02.2007
| 120785 views |
  • submit to reddit
        // Ref: http://www.geekpedia.com/Question19_How-can-I-insert-a-new-line-in-a-TextBox.html
// Make sure MultiLine property is true and use "\r\n"

  TextBox1.Text = "First line\r\nSecond line";
    

Comments

Boyan Kostadinov replied on Wed, 2008/02/20 - 2:33pm

A better choice would be to use Environment.NewLine instead of "\r\n"