Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making textboxes come up to the same size using canGrow 1

Status
Not open for further replies.

sxux

Programmer
Oct 14, 2002
3
US
Hi ,

I have a form in which i have a series of Textboxes in a row.At design time I have all of the textboxes set to the same height.However the data that is loaded into these text boxes is variable in length.
When printed I would like all of the textboxes to come to the height of that text box which has max height after growing in size( for all of the boxes i had set the CanGrow property to True).

Also Microsoft help for Cangrow specifies that it is only during the printing that the boxes grow, and no events are provided for the form to intercept the printing process.

Any help appreciated.


 
sxux,

The only way that I have seen this accomplished
is to do the following:

Adapted from: Thomas M. Brittell "GrowBox"

1) Convert all text formats to fixed-pitch

2) On a form (or report) put your controls as
you normally would, but with a transparent
border. Let's call them C1, C2 and C3.
They are populated from a query.

3) On the same form (or report) put additional
controls C1', C2' and C3'. These have properties
can grow/shrink. They are placed "underneath" your
other controls. They also have a visible
border. They are populated by an additional
field in your query.

4) Your query will contain values for your
regular controls, but will contain a reference
to an expression populated by a function.

The function will, for each field, count the
number of lines required to map it on the form
or report. For the largest field, it will return
enough "vbCrLf"s as its value.

The end result is that although your "true" data
appears inconsistently, with no borders, the
invisible data appears with consistent borders.

I've used this in databases containing software
test procedures and it works okay.

hth,
Wayne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top