Home All Groups Group Topic Archive Search About

number of lines in Richtextbox

Author
9 Jan 2006 9:40 AM
LeAnne
If the user types some text into a rich textbox, i need to know how many
lines there are in the control.
Note, I'm not interested in counting the number of the carriage returns or
line feeds.

Suppose, the rich text is the height of a textbox (can view only one line at
a time), then if the user keeps typing and word wrap = TRUE and multi line =
TRUE, then it goes to the new line.
What i'd like to do is to automatically increase the height of the rich
textbox control to display all the text (increasing the height of the
control as and when needed).
But by default the height will be for one row (one line only).

How can i do this?

Author
9 Jan 2006 10:37 AM
Peter Proost
Hi

RichTextBox1.Lines.Length should get you the number of lines

Hth, greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"LeAnne" <A***@bogusemail.com> schreef in bericht
news:OYhUODQFGHA.3348@TK2MSFTNGP15.phx.gbl...
> If the user types some text into a rich textbox, i need to know how many
> lines there are in the control.
> Note, I'm not interested in counting the number of the carriage returns or
> line feeds.
>
> Suppose, the rich text is the height of a textbox (can view only one line
at
> a time), then if the user keeps typing and word wrap = TRUE and multi line
=
> TRUE, then it goes to the new line.
> What i'd like to do is to automatically increase the height of the rich
> textbox control to display all the text (increasing the height of the
> control as and when needed).
> But by default the height will be for one row (one line only).
>
> How can i do this?
>
>
Author
9 Jan 2006 11:50 AM
Herfried K. Wagner [MVP]
"Peter Proost" <pproost@nospam.hotmail.com> schrieb:
> RichTextBox1.Lines.Length should get you the number of lines

This property will actually return the number of physical lines, not the
number of lines shown on the screen.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
9 Jan 2006 12:08 PM
Peter Proost
Hi Herfried, I see what you mean, I was to fast reading the op's post.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
news:#rJ0hLRFGHA.752@TK2MSFTNGP12.phx.gbl...
> "Peter Proost" <pproost@nospam.hotmail.com> schrieb:
> > RichTextBox1.Lines.Length should get you the number of lines
>
> This property will actually return the number of physical lines, not the
> number of lines shown on the screen.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
Author
9 Jan 2006 1:53 PM
Peter Proost
Forget my first answer, this example by Herfried should help you

http://groups.google.be/group/microsoft.public.dotnet.languages.vb/msg/dc907
1779b6c7e98


hth Greetz Peter


--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"Peter Proost" <pproost@nospam.hotmail.com> schreef in bericht
news:ur4wXVRFGHA.3176@TK2MSFTNGP12.phx.gbl...
> Hi Herfried, I see what you mean, I was to fast reading the op's post.
>
> Greetz Peter
>
> --
> Programming today is a race between software engineers striving to build
> bigger and better idiot-proof programs, and the Universe trying to produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
> news:#rJ0hLRFGHA.752@TK2MSFTNGP12.phx.gbl...
> > "Peter Proost" <pproost@nospam.hotmail.com> schrieb:
> > > RichTextBox1.Lines.Length should get you the number of lines
> >
> > This property will actually return the number of physical lines, not the
> > number of lines shown on the screen.
> >
> > --
> >  M S   Herfried K. Wagner
> > M V P  <URL:http://dotnet.mvps.org/>
> >  V B   <URL:http://classicvb.org/petition/>
> >
>
>
Author
9 Jan 2006 2:57 PM
Herfried K. Wagner [MVP]
Peter,

"Peter Proost" <pproost@nospam.hotmail.com> schrieb:
> Forget my first answer, this example by Herfried should help you
>
> http://groups.google.be/group/microsoft.public.dotnet.languages.vb/msg/dc907
> 1779b6c7e98

;-)

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
9 Jan 2006 3:45 PM
Peter Proost
Herfried, it's my first day at work after a two week holiday :-) so maybe
that explains something ;-)

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
news:eazkA0SFGHA.1816@TK2MSFTNGP11.phx.gbl...
> Peter,
>
> "Peter Proost" <pproost@nospam.hotmail.com> schrieb:
> > Forget my first answer, this example by Herfried should help you
> >
> >
http://groups.google.be/group/microsoft.public.dotnet.languages.vb/msg/dc907
Show quoteHide quote
> > 1779b6c7e98
>
> ;-)
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
Author
9 Jan 2006 4:28 PM
Cor Ligthert [MVP]
Peter,

We saw it, there was somebody asking something with the nick PeterPr however
I was in doubt if it was you and therefore I did not taken that time in it
as it was if it was you.

Cor
Author
10 Jan 2006 7:20 AM
Peter Proost
That indeed wasn't me, and it was an awfully long question like I liked to
post them when I first started using the ng  :-)

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht
news:ukSUamTFGHA.1676@TK2MSFTNGP09.phx.gbl...
> Peter,
>
> We saw it, there was somebody asking something with the nick PeterPr
however
> I was in doubt if it was you and therefore I did not taken that time in it
> as it was if it was you.
>
> Cor
>
>
Author
10 Jan 2006 11:11 AM
LeAnne
Beautiful mate, worked like a charm...

Show quoteHide quote
"Peter Proost" <pproost@nospam.hotmail.com> wrote in message
news:uTwTbQSFGHA.3000@TK2MSFTNGP14.phx.gbl...
> Forget my first answer, this example by Herfried should help you
>
> http://groups.google.be/group/microsoft.public.dotnet.languages.vb/msg/dc907
> 1779b6c7e98
>
>
> hth Greetz Peter
>
>
> --
> Programming today is a race between software engineers striving to build
> bigger and better idiot-proof programs, and the Universe trying to produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>
> "Peter Proost" <pproost@nospam.hotmail.com> schreef in bericht
> news:ur4wXVRFGHA.3176@TK2MSFTNGP12.phx.gbl...
>> Hi Herfried, I see what you mean, I was to fast reading the op's post.
>>
>> Greetz Peter
>>
>> --
>> Programming today is a race between software engineers striving to build
>> bigger and better idiot-proof programs, and the Universe trying to
>> produce
>> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>>
>> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
>> news:#rJ0hLRFGHA.752@TK2MSFTNGP12.phx.gbl...
>> > "Peter Proost" <pproost@nospam.hotmail.com> schrieb:
>> > > RichTextBox1.Lines.Length should get you the number of lines
>> >
>> > This property will actually return the number of physical lines, not
>> > the
>> > number of lines shown on the screen.
>> >
>> > --
>> >  M S   Herfried K. Wagner
>> > M V P  <URL:http://dotnet.mvps.org/>
>> >  V B   <URL:http://classicvb.org/petition/>
>> >
>>
>>
>
>