Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody, I have a qustion,can I automatically change the size of the forms according to the size of the textbox? I know textbox automatically resize goes, but I don´t know how to write code to change size a form.

What I have tried:

C#
Form2.AutoSize = true;
isn't the right way
Posted
Updated 2-Oct-20 0:09am
Comments
Sandeep Mewara 2-Oct-20 5:32am    
What exactly you intend to achieve/do?
dejf111 2-Oct-20 5:40am    
I set the textbox to auto-size only when text form is written into the textbox it won't be large enough,therefore I would like the form to grow accordingly
Sandeep Mewara 2-Oct-20 5:48am    
so as you type and text length grows, you will grow your textbox and form accordingly?
If so, its not a good practice to play with form window like this with your text typing.

instead try multi-line text in fixed form. It can have a scroll once length of text exceed text view.
dejf111 2-Oct-20 5:57am    
You're right this solution didn't occur to me, thank you very much

1 solution

Answering here to remove from unanswered list.

As shared with OP, based on the need, it's not suggestible to have a form with size growing or shrinking with typing or removing text in a textbox.

Based on the need, using a multiline textbox would do. It would have a scroll for longer text once length of text exceed text view.

OP seems to agree with it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900