Resize Textbox to show all text

I currently have a textbox which is populated from the database, I was wondering how I would go about resizing the textbox to fit this text. Now I've seen it done like:


Dim mySize As  New System.Drawing.SizeF
 
Dim myFont As New System.Drawing.Font  (Me.TextBox1.Font.FontFamily, Me.TextBox1.Font.Size)
 
mySize = e.Graphics.MeasureString("This is a test", myFont)
Me.TextBox1.Width = CType(Math.Round(mySize.Width, 0), Integer)

Open in new window

directxBOBAsked:
Who is Participating?
 
CB_ThirumalaiConnect With a Mentor Commented:
Me.TextBox1.Width = Unit.Pixel(8 * TextBox1.Text.Length)
0
 
OmerFarukZConnect With a Mentor Commented:
Try jquery and auto grow plug-in. Please check followin link. Cool coding.

http://javascriptly.com/2008/09/quick-useful-jquery-plugins/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.