Counting Lines of Text in TextBox

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
 
J

Jeff Boyce

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.
 
M

Marshall Barton

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.
 

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