Textbox lines.

  • Thread starter Thread starter Shawn
  • Start date Start date
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.
 
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.
 
Back
Top