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).
CodePudding user response:
You can try to put the AutoSize
to True of the Form
Open the Form
and put a Label
on it , the Label gets a Name lets say Label1
.
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_Load
if it is another Label you have to adjust it to the right Name:
Label1.Text = "This is a example text and a bit longer zo the form is getting bigger"
Run it and there it is :