Textbox lines.

S

Shawn

Anybody know how to use wordwrap=true and multiline = true on a textbox, but
still have the textbox.lines attribute advance if the wordwrap happens?

I have a large textbox that is setup like this and I want to get the number
of lines of text, but right now, unless a user hits Enter, it always reports
1 line.
 
L

Leon Mayne [MVP]

Shawn said:
Anybody know how to use wordwrap=true and multiline = true on a
textbox, but still have the textbox.lines attribute advance if the
wordwrap happens?
I have a large textbox that is setup like this and I want to get the
number of lines of text, but right now, unless a user hits Enter, it
always reports 1 line.

I don't think you can. The number of lines is defined literally as the
number of lines, e.g. the number of sentences delimited by a newline.

You could:
1) Do a programmatical split on CrLf characters to get the 'real' number of
lines, then
2) For each of the lines, divide the number of characters by the maximum
character width in the textbox, then
3) Add all the numbers up

That should give you roughly the number of lines in the wrapped textbox.
 

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