number of lines in Richtextbox

L

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?
 
P

Peter Proost

Hi

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

Hth, greetz Peter
 
H

Herfried K. Wagner [MVP]

Peter Proost said:
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.
 
P

Peter Proost

Hi Herfried, I see what you mean, I was to fast reading the op's post.

Greetz Peter
 
P

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)
 
C

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
 
P

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top