>I'm sure this has been asked before, but the search isn't working. Is there a formula that will take the font, font size, and the number of characters and return what width the textbox should be set to? I realize proportional fonts make things harder, but if it used an average character width, that would be fine.
>
>Thanks,
>
>Michelle
Michelle,
Try:
Txtbox1.Width = Txtbox1.Maxlength*fontmetric(7,Txtbox1.Fontname,Txtbox1.FontSize)
You will also have to take into account the attributes like Bold, Italic, etc. You can build a string based on those properties and pass that as the fourth parameter to Fontmetric.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao