Home All Groups Group Topic Archive Search About

Add a line break in label.text

Author
6 Jan 2006 7:28 PM
Drew Leon
I am learning how to program using Visual Studio 2005 (I chose Visual Basic
to start).

My question is:

I have a sentence which I want to split in two. I would like half the
sentence on the first line, and the other half right under it, on the second
line. How can I accomplish this feat?

P.S. Right now I can only get the label to show the sentence to me all on
one line.

--
Have a great day!
Drew Leon

Author
6 Jan 2006 7:51 PM
Herfried K. Wagner [MVP]
"Drew Leon" <DrewL***@discussions.microsoft.com> schrieb:
> I have a sentence which I want to split in two. I would like half the
> sentence on the first line, and the other half right under it, on the
> second
> line. How can I accomplish this feat?

\\\
Me.Label1.Text = "Hello" & ControlChars.NewLine & "World"
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
6 Jan 2006 9:01 PM
Drew Leon
Thank you very much Herfried. I spent the longest time trying to find the
answer to this question.
--
Have a great day!
Drew Leon


Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "Drew Leon" <DrewL***@discussions.microsoft.com> schrieb:
> > I have a sentence which I want to split in two. I would like half the
> > sentence on the first line, and the other half right under it, on the
> > second
> > line. How can I accomplish this feat?
>
> \\\
> Me.Label1.Text = "Hello" & ControlChars.NewLine & "World"
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
Author
6 Jan 2006 8:02 PM
Confessor
=?Utf-8?B?RHJldyBMZW9u?= <DrewL***@discussions.microsoft.com> wrote in
Show quoteHide quote
news:9FDA5C03-1A71-40B9-966C-38F22587FC1D@microsoft.com:

> I am learning how to program using Visual Studio 2005 (I chose Visual
> Basic to start).
>
> My question is:
>
> I have a sentence which I want to split in two. I would like half the
> sentence on the first line, and the other half right under it, on the
> second line. How can I accomplish this feat?
>
> P.S. Right now I can only get the label to show the sentence to me all
> on one line.
>

Label1.Text = "He thrusts his fists" & vbCrLf & "Against the Posts"

....which only works with explicitly entered text...

If you wanted to wrap automatically following a given number of
letters/words in a string variable, the coding would be a bit more
complicated, I think. Probably beyond my current skill level. A simple
Google search was sufficient to unearth this keyword...

Karma, don't fail me now,
The Confessor
Author
6 Jan 2006 9:02 PM
Drew Leon
Thank you for your quick response. I was racking my head all morning
searching for the answer. Much appreciated.
--
Have a great day!
Drew Leon


Show quoteHide quote
"Confessor" wrote:

> =?Utf-8?B?RHJldyBMZW9u?= <DrewL***@discussions.microsoft.com> wrote in
> news:9FDA5C03-1A71-40B9-966C-38F22587FC1D@microsoft.com:
>
> > I am learning how to program using Visual Studio 2005 (I chose Visual
> > Basic to start).
> >
> > My question is:
> >
> > I have a sentence which I want to split in two. I would like half the
> > sentence on the first line, and the other half right under it, on the
> > second line. How can I accomplish this feat?
> >
> > P.S. Right now I can only get the label to show the sentence to me all
> > on one line.
> >
>
> Label1.Text = "He thrusts his fists" & vbCrLf & "Against the Posts"
>
> ....which only works with explicitly entered text...
>
> If you wanted to wrap automatically following a given number of
> letters/words in a string variable, the coding would be a bit more
> complicated, I think. Probably beyond my current skill level. A simple
> Google search was sufficient to unearth this keyword...
>
> Karma, don't fail me now,
> The Confessor
>