h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Resize TextBox in C#.net

Here, I gave a TextBox resize in C#.net.user can call this function in form load event.
private void txtWidth(TextBox txt)
{
  System.Drawing.Graphics g = txt.CreateGraphics();
  float maxwidth = 0f;
  float w = g.MeasureString(txt.Text, txt.Font).Width;
 if (w > maxwidth)
{
     maxwidth = w;
                g.Dispose();
         txt.Width = (int)maxwidth;
        }
}