1
votes

We are doing some reporting using the VB6 DataReport. I have set the CanGrow property of some RptTextBox controls to True, and I have used RptLine controls between RptTextBox controls.

My problem is that the RptLine control doesn't have the CanGrow property, so it will not grow in tandem with a RptTextBox control. If there is any event triggering when a RptTextBox changes, I can use that to get the RptTextBox Height property, and can assign that to RptLine.

Are there any events I can use? Or is there any other way to make RptLine controls have same height as RptTextBox?

EDIT:

1)RptTextBox height=RptShape height

enter image description here

enter image description here

2)RptTextBox height < RptShape height

enter image description here

enter image description here

1

1 Answers

0
votes

Unfortunately, there are no events which can be used to make each instance of the control different from each other. So the only way you can do this is to take advantage of the way the controls work.

The workaround is to create a duplicate RptTextBox control of the one which you want to use. We are only interested of the right hand (or left hand) edge of the control.

Ensure the following properties on the duplicate control are set:

  • BackColor : &H00FFFFFF& (This should be the same as the background)
  • BackStyle : 1 - rptBkOpaque
  • BorderColor : &H00000000& (or whatever colour you want to use)
  • BorderStyle : 1 - rptBSSolid
  • CanGrow : True
  • DataField : <same as the control you copied>
  • ForeColor : &H00FFFFFF& (This should be the same as the background)

Create a RptShape control, and set the following properties:

  • BackColor : &H00FFFFFF& (This should be the same as the background)
  • BackStyle : 1 - rptBkOpaque
  • BorderStyle : 0 - rptBSTransparent
  • Height : <As large as possible>
  • Left : <same as the duplicate control>
  • Width : <same as the control you copied>

Right click on the Shape, and select "Bring to Front"

Essentially, the duplicate control will resize to the identical size as the original field, so its height will always been the same. The RptShape appears above this control, with the foreground and background colours being white, so it is being used to blank out the left, top, and bottom borders of the RptTextBox control. If you want to have a line to the left of your text, you will have to move the shape to the right until the left side is seen.

Design View

Runtime View