Connecting Tech Pros Worldwide Forums | Help | Site Map

line break in Label

Grey
Guest
 
Posts: n/a
#1: Nov 16 '05
how to set the line break character in the Text properties of Label??



Peter Jausovec
Guest
 
Posts: n/a
#2: Nov 16 '05

re: line break in Label


Hi,

Use label1.Text = "First line" + Environment.NewLine + "Second line";

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Grey" <erickwyum@i-cable.com> je napisal v sporočilo
news:uHXa%23RgzEHA.1452@TK2MSFTNGP11.phx.gbl ...[color=blue]
> how to set the line break character in the Text properties of Label??
>
>[/color]


Dino L.
Guest
 
Posts: n/a
#3: Nov 16 '05

re: line break in Label


Peter Jausovec wrote:
[color=blue]
> Hi,
>
> Use label1.Text = "First line" + Environment.NewLine + "Second line";
>[/color]
or

label1.Text = "First line\nSecond line";

Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#4: Nov 16 '05

re: line break in Label


Dino L. <sekretar@gmail.com> wrote:[color=blue]
> Peter Jausovec wrote:
>[color=green]
> > Hi,
> >
> > Use label1.Text = "First line" + Environment.NewLine + "Second line";
> >[/color]
> or
>
> label1.Text = "First line\nSecond line";[/color]

No, that won't work - you need \r\n, not just \n.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
James Curran
Guest
 
Posts: n/a
#5: Nov 16 '05

re: line break in Label


Unless this is for ASP.NET, inwhich case I believe we'll want

label1.Text = "First line<BR>Second line";

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com


"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1c07aef692ef71cb98b941@msnews.microsoft.c om...[color=blue]
> Dino L. <sekretar@gmail.com> wrote:[color=green]
> > Peter Jausovec wrote:
> >[color=darkred]
> > > Hi,
> > >
> > > Use label1.Text = "First line" + Environment.NewLine + "Second line";
> > >[/color]
> > or
> >
> > label1.Text = "First line\nSecond line";[/color]
>
> No, that won't work - you need \r\n, not just \n.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too[/color]


Closed Thread