Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleSize a TextBox to fit its contents
KeywordsTextBox, size, fit, resize
CategoriesControls
 
Make sure the form's font matches the TextBox's (or use a hidden PictureBox control). Use the form's TextWidth and TextHeight methods to see how much room the text needs. Then size the TextBox accordingly, allowing a little extra room for the TextBox's borders.
 
' Make the TextBox fit its contents.
Private Sub FitTextBoxContents(ByVal txt As TextBox)
    Font = Text1.Font
    txt.Width = TextWidth(txt.Text) + 120
    txt.Height = TextHeight(txt.Text) + 120
End Sub
 
 
Copyright © 1997-2001 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated