counting lines of textbox

H

HDB

Ok. I have a windows form with a textbox for displaying certain messages.
Multiline=true and wordwrap=true. I want to know the amount of the lines
currently showing. That should not be any rocket-science, eh?

Textbox.lines.length() only returns the amount of lines ending with a 'hard'
CrLF, not the lines with a 'soft' CrLf done by the wordwrapping option. Why,
I don't know. I don't want to know how much lines are ending with 'hard'
CrLf. I want to know how much lines are currently displayed (and thus
depending on the horizontal size of the textbox). Anyone?
 
C

Cor Ligthert

Hi Herfried,

IMHO this conflicts with if you dock a textbox or make it in any other way
more sophisticated to the screen.

Therefore I did not want to answer this.

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor Ligthert said:
IMHO this conflicts with if you dock a textbox or make it in any other way
more sophisticated to the screen.

Therefore I did not want to answer this.

?!?

You can convert the soft like breaks into hard line breaks and then
count the number of lines. You don't need to change the content of the
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