Counting Lines of Text in TextBox

  • Thread starter Thread starter JBA
  • Start date Start date
J

JBA

In a form, I have a text box in which memo text wraps. Is there any code
that can count the number of lines of text that display in the textbox?

My only workaround at this point is to use a non-proportional font like
Courier, count the characters and divide by the number of characters that a
line might contain. Unfortunately, this approach only gives me a rough
estimate of the number of lines. And I'm stuck with Courier when I prefer
Arial.

Is there another way to count lines of text?

Thanks.

Jim
 
Why?

What will knowing the number of lines of text allow you to do?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
JBA said:
In a form, I have a text box in which memo text wraps. Is there any code
that can count the number of lines of text that display in the textbox?

My only workaround at this point is to use a non-proportional font like
Courier, count the characters and divide by the number of characters that a
line might contain. Unfortunately, this approach only gives me a rough
estimate of the number of lines. And I'm stuck with Courier when I prefer
Arial.

Is there another way to count lines of text?


The TextHeight function at
http://www.lebans.com/textwidth-height.htm
can be used to do that.
 
Back
Top