Allowing a textbox and it's label to be the same size

J

John Baker

I have a report which has a label and a textbox side by side. The textbox
"Can Grow" property is set to yes. I have set the properties of both to have
a solid border. When the textbox size does grow then the label is left at
the same size. Is there any way in which I can make the label size grow in
proportion with the textbox.

Any help greatly appreciated.
 
M

Marshall Barton

John said:
I have a report which has a label and a textbox side by side. The textbox
"Can Grow" property is set to yes. I have set the properties of both to have
a solid border. When the textbox size does grow then the label is left at
the same size. Is there any way in which I can make the label size grow in
proportion with the textbox.


No there isn't, the height of the text box is not known
until the Print event, but you canonly change the size of
something in the Format event. Kind of a catch 22
situation.

What you can do is use code with the report's Line method in
the Print event to draw the lines your self. There can be
more to it than this, but the basic statements would be
like:

With Me.label
Me.Line (.Left, .Top) - Step(0, Me.textbox.Height)
Me.Line (.Left + .Width, .Top) - Step(0. Me.textbox.Height)

The horizontal lines can be line controls that you place at
the top and bottom of the text box, just make sure that they
don't overlap the text box.

If your situation gets much more complicated than that, you
may find it easier to use Stephen Lebans' PrintLines
reoutines at www.lebans.com
 
J

John Baker

Thank you very much for your time Marsh.

John.

Marshall Barton said:
No there isn't, the height of the text box is not known
until the Print event, but you canonly change the size of
something in the Format event. Kind of a catch 22
situation.

What you can do is use code with the report's Line method in
the Print event to draw the lines your self. There can be
more to it than this, but the basic statements would be
like:

With Me.label
Me.Line (.Left, .Top) - Step(0, Me.textbox.Height)
Me.Line (.Left + .Width, .Top) - Step(0. Me.textbox.Height)

The horizontal lines can be line controls that you place at
the top and bottom of the text box, just make sure that they
don't overlap the text box.

If your situation gets much more complicated than that, you
may find it easier to use Stephen Lebans' PrintLines
reoutines at www.lebans.com
 

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