adjust the height of a label

C

clara

Hi all,

A label on my form will be filled by a muti-line of comment, the line number
is variable, so how to make the label adjust to it programmically.

Clara

thank you so much for your help
 
V

Vergel Adriano

Clara,

In Excel 2003, you can set the AutoSize property of the label to True.
 
C

clara

Hi Vergel,

Thank you very much! Let's drill things down a little. Below the label,
there is a textbox, so when the label is growing automatically downwards, the
position of the textbox is also needed to shift down accordingly. How I can
do it?

Clara

thank you so much for your help
 
V

Vergel Adriano

Clara,

Each time you change the contents of the label, you can push your textbox
down. As an example, the code below always puts TextBox1 5 pixes below
Label1.

Label1.Caption = strSomeReallyLongText
TextBox1.Top = Label1.Top + Label1.Height + 5

If you have more controls below the label that need to move down, consider
placing the controls in a Frame control. That way, you only need to move the
Frame and not have to worry about each individual control.

Label1.Caption = strSomeReallyLongText
Frame1.Top = Label1.Top + Label1.Height + 5
 

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