Programmatically changing the size of a textbox

  • Thread starter Thread starter Bill Gower
  • Start date Start date
B

Bill Gower

I have a textbox that is multiline but I only want to show one line at the
start until that line is filled in. I am going to use the textchanged event
to check the length of the text in the field. If the length of the text is
greater than the length of the field, I am going to change the height of the
textbox to show another line and when that is filled I am going to add a new
line etc etc. My question is what is the easiest way to move all the
controls below this textbox down?

Bill
 
If you also need to change the size of the form the fit the resized text box
and all the controls below it, then the easiest way is to anchor all the
controls below to the bottom edge of the form (add AnchorStyles.Bottom to
the Anchor property of the controls), then just resize the form by the
amount you need to increase the textbox by. You can also include the textbox
itself in the anchoring so you only have to resize the form.
 
Back
Top