Programmatically changing the size of a textbox

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
 
C

Clive Dixon

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top