25

I'd like to insert a newline into a Windows Forms text label through the design view. Something like setting the text to be:

Lorem ipsum \n dolor sit amet

or

Lorem ipsum <br/> dolor sit amet

However, none of the above works. How can one insert a new line into a label? I have a static text that I'll be displaying, so I don't want to do it via code.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
asenovm
  • 6,397
  • 2
  • 41
  • 52

2 Answers2

35

When you edit the "Text" field, you should see a small arrow on the right side of that text box. If you press it, a multiline string editor should appear. Here you can insert your mulitline text.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user287107
  • 9,286
  • 1
  • 31
  • 47
20

You can do it in the code as follows:

private void Form1_Load(object sender, EventArgs e)
{
     label1.Text = "This is the first line\r\nAnd this is the second line.";
}
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
  • Question says through the design view. Nevertheless, if it would had to be done pogramatically, this would be the correct answer :D – moarra Jul 22 '20 at 15:51