• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 475
  • Last Modified:

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

0
directxBOB
Asked:
directxBOB
2 Solutions
 
CB_ThirumalaiCommented:
Me.TextBox1.Width = Unit.Pixel(8 * TextBox1.Text.Length)
0
 
OmerFarukZCommented:
Try jquery and auto grow plug-in. Please check followin link. Cool coding.

http://javascriptly.com/2008/09/quick-useful-jquery-plugins/
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now