How would you change the Form size depending on the width/length of a Label?
I need to resize a Form depending on how much text there is in a Label (the text is automatically generated from case statements).
How would you change the Form size depending on the width/length of a Label?
I need to resize a Form depending on how much text there is in a Label (the text is automatically generated from case statements).
Copyright © 2021 Jogjafile Inc.
You can try to put the
AutoSizeto True of theFormOpen the
Formand put aLabelon it , the Label gets a Name lets sayLabel1.Rightclick on the Form and open Properties
Then Choose AutoSize to True
Then return to the Form and dubbleclick on the Form this case Form1, Form1.vb is open.
In
Form1_Loadif it is another Label you have to adjust it to the right Name:Run it and there it is :
Look here https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form.autosize?view=windowsdesktop-6.0