Text box height

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to get a text box on a form to increase its height to just the right size to show all the text when the form is displayed on the screen. The "Can grow" property only seems to work when printing the form, but I want to display the text that way.

Maybe I would need to code the box to grow on formatting, but then how would I find the correct height ? It is obviously a function of the number of lines of text, but I cant see how to figure that out.

Any ideas? I would be terminally grateful if you could give me some.

Thanks

Vaughan
 
Vaughan,
I've never had need to do this, but I would think you could do something
with the OnCurrent event of the form.
For example, if the text control (ex. [YourText]) was approx. 25 characters
wide, and the Len([YourText]) was 100, then...
100/25 = 4... then multiply the text control Height x 4
Because of proportional fonts, this will not work precisely, and you'll have
to expirement a bit, but this should work in most cases.
hth
Al Camp

Vaughan said:
Is it possible to get a text box on a form to increase its height to just
the right size to show all the text when the form is displayed on the
screen. The "Can grow" property only seems to work when printing the form,
but I want to display the text that way.
Maybe I would need to code the box to grow on formatting, but then how
would I find the correct height ? It is obviously a function of the number
of lines of text, but I cant see how to figure that out.
 
See:
http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth
and TextHeight methods. It is multiline aware and can work in both
Report and Form views. Includes a sample report to show you how to
autosize individual controls with different formatting on the same line
to simulate RTF style text.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Vaughan said:
Is it possible to get a text box on a form to increase its height to
just the right size to show all the text when the form is displayed on
the screen. The "Can grow" property only seems to work when printing the
form, but I want to display the text that way.
Maybe I would need to code the box to grow on formatting, but then how
would I find the correct height ? It is obviously a function of the
number of lines of text, but I cant see how to figure that out.
 
Back
Top