How can I add newlines to a Label
's Text
at design time? There are some posts on Stack Overflow on how to do this in code-behind, but there is no post about that for design time yet, it seems?

- 60,696
- 40
- 206
- 339

- 19,668
- 65
- 192
- 300
-
Possible duplicate of *[Word wrap for a label in Windows Forms](http://stackoverflow.com/questions/1204804/word-wrap-for-a-label-in-windows-forms)* – Peter Mortensen Nov 07 '16 at 13:14
5 Answers
When you click on the label Text property in the Property window for the label, a drop down will appear in which you can, when you press Enter, go to the new line. I just tried it, and it works in Visual Studio 2010.
Here's a screenshot to clarify:

- 30,738
- 21
- 105
- 131

- 8,556
- 1
- 27
- 33
-
1All this time I've been using textboxes for the multiline because I never could figure that out in the properties window lol.. Thanks man. – Codezilla Jul 04 '14 at 01:32
-
1Just a comment, it does not work in legacy versions of Visual Studio, like Visual Studio NET 2003 (Net Framework 1.1). Of course, they barely exist but take it into account if you are doing something in a legacy project ;) – Willy Nov 16 '17 at 10:04
-
doesn't work in my Visual Studio 2012 too. Thanks for the answer. I only know multiline mode exist only in textbox – monikapatelIT Nov 16 '17 at 21:14
-
Hm, it should be working on VS2012. I think that my original answer was made after trying it in VS2012. Look at the time when I answered the question. – Nikola Davidovic Nov 16 '17 at 21:50
Design Time \r\n will do the trick -
label1.Text = "Multi-line \r\nlabel"
Also you can try setting in designer generated code -
this.label2.Location = new System.Drawing.Point(151, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Multi-line \r\n label";
Run time -
label1.Text = "Multi-line" + Environment.NewLine + "label";

- 7,844
- 3
- 28
- 39
-
1Design time refers to the user designing the app in visual studio. All the code above is code-behind. – Candide Nov 08 '12 at 18:35
-
@Candide what makes you say that? I clearly mentioned that this is designer generated code and if you think designer generated code is not design time then I will happily delete my answer. – indiPy Nov 08 '12 at 22:43
-
1
You can use <br />
in your string, for example :
MyLabel.Text = "This is my text" + "<br />" + "This is my new line text";

- 3,223
- 3
- 28
- 40

- 528
- 1
- 4
- 12
When you get the formatting box to drop down, use 'Shift+Enter' to go to a new line. 'Enter' just causes the box to close. At least, that's my experience in VS2015.
Set Autosize to False using Properties > Layout > Autosize then set Width and Height parameters depending on your text size using Properties > Layout > Size. This worked for me with Width as 60 and Height as 40 for Label to display like below.
3: Auto
H: Home