Resizing TextBox on Detail_Format

S

Serge Olivier

Hi folks,
A report has several TextBox in the detail section. Among them, one can warp
on multiple lines. As I am using Solid Border on the controls to print each
"cells" Excel style, all the TextBox end up with different height and it
looks ugly...

I tried to rezise them in the Detail_Format event with no success. The
TextBox won't grow. Seem like the control has not been resized yet at this
time or it does not change the Height property even if it grows.

Here it is: txtDesc being the control that grows with the content.
All controls have CanGrow=True

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
Me.txtCostMisc.Height = Me.txtDesc.Height 'At time time, txtDesc should
have grown... isn't it?
Me.txtCostParts.Height = Me.txtDesc.Height
Me.txtHrePaint.Height = Me.txtDesc.Height
Me.txtHreRepair.Height = Me.txtDesc.Height
Me.txtQty.Height = Me.txtDesc.Height
End Sub

Thank for your advice.
Serge
 
M

Marshall Barton

Serge said:
A report has several TextBox in the detail section. Among them, one can warp
on multiple lines. As I am using Solid Border on the controls to print each
"cells" Excel style, all the TextBox end up with different height and it
looks ugly...

I tried to rezise them in the Detail_Format event with no success. The
TextBox won't grow. Seem like the control has not been resized yet at this
time or it does not change the Height property even if it grows.

The adjusted height of a can grow text box is not available
until the Print event,. Unfortunatly, that's too late to
change the size of the smaller text boxes.

You can get around this by setting all the text boxes border
style to Transparent and drawing the border lines yourself
using the Line method in the Print event. It might be
something like:
Me.Line (Me.txtCostParts.Left, Me.txtCostParts.Top) _
- Step(Me.txtCostParts.Width, Me.txtDesc.Height), ,B

[I would normally suggest that you check Help for details,
but the later versions of Help have made a complete hash of
descriptions of the Line and Circle methods. When you read
one of those topics, note that the example uses the correct
syntax.]

This can get tricky when your text box gets split across a
page boundary, so you might prefer to use Stephen Lebans
PrintLines download 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