stretching a textbox

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

Guest

Is it possible to take a textbox and have it expand to a new length depending
on the length of the info in it? I could have company names show in a
textbox as short as 3 letters to one that would have 24 letters (or any new
ones that might be longer). The info in the txtbox would be placed there
from a combobox selection.
Thanks in advance to anyone who responds.
*** John
 
JohnE said:
Is it possible to take a textbox and have it expand to a new length depending
on the length of the info in it? I could have company names show in a
textbox as short as 3 letters to one that would have 24 letters (or any new
ones that might be longer). The info in the txtbox would be placed there
from a combobox selection.


Yes, it's possible, but the code to determine the length of
the text is extremely complex. Fortunately, Stepehen Lebans
worked it out in his TextHeightWidth function at
www.lebans.com. I think you would use it something like
this:
Me.txtbox.Width = FTextWidth(Me.txtbox)

On the other hand, why bother? If your form has enough
real estate to accomodate a wider text box, why not just
make it wider in the design and not worry about the shorter
names that don't fill the text box?
 
Back
Top