URGENT VB.NET - Need to resize textbox automatically without using MultiLine/ScrollBars properties

Hello,

I was wondering if it was possible to have a textbox expand in width and height as the user types.  I know that you can set the Multi-Line property to True and set the ScrollBars property, but my client doesn't want to see or use the scrollbars.  Should I use a FlowLayoutPanel or a TableLayoutPanel?  Do I have to set Anchoring properties?  Please see the attached example file.

Thanks for your help!

Expanding TextBox Example
Eric BurtonSr.ProgrammerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
might not be perfect but at least you get something to start with:
 
   Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        TextBox1.Multiline = True
    End Sub

    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        Dim MessageSize As SizeF = TextBox1.CreateGraphics().MeasureString(TextBox1.Text,
                                                TextBox1.Font,
                                                TextBox1.Width,
                                                New StringFormat(0))
        TextBox1.Size = New Size(TextBox1.Width, MessageSize.Height + 10)
    End Sub

Open in new window

ArkCommented:
To make GC life easier:
Using g = TextBox1.CreateGraphics()
    g.MeasureString(...)
End Using

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.