counting lines of textbox

  • Thread starter Thread starter HDB
  • Start date Start date
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?
 
* "HDB said:
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?

I don't think that there is a managed way to do that. You may want to
take a look at this VB6 implementation:

<URL:http://www.activevb.de/tipps/vb6tipps/tipp0098.html>
 
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
 
* "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

Similar Threads

Textbox lines. 1
Textbox line property 31
[VB.NET] Using SendMessage and EM_GETLINE 4
GDI........... textbox 1
TextBox WordWrap and Lines Property 1
Catch problem 5
GDI textbox.......... 3
mulitline textboxes 4

Back
Top