How to resize a list box when form resizes.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to change the size of a list box vertically (and perhaps horizontally)
when the form resizes. Can someone please point me to some code.

PS I would like to not reinvent the wheel as I know there are some tricky
issues due to form's min/max size etc.

many thanks
 
Thanks but your code for sub-form resizing does not work.
It falls over when the form height is small.

As I said/implied I would love code that has ALL the tricky issues resolved.

--
Regards
Tom


Duane Hookom said:
You can use code in the form's Resize event. You may need to change the
"100" depending on your form.

Private Sub Form_Resize()
Me.lboProject.Height = Me.InsideHeight - (Me.lboProject.Top + 100)
End Sub

There is a sample of this at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.
 
ThomasAJ said:
Thanks but your code for sub-form resizing does not work.
It falls over when the form height is small.

As I said/implied I would love code that has ALL the tricky issues resolved.

So add an If-Then statement to prevent the form being resized below a prescribed
minimum. Say the current code works fine until the form is less than 2 inches
tall (2880 twips).

If Me.InsideHeigth < 2880 Then Me.insideHeight = 2880
Me.lboProject.Height = Me.InsideHeight - (Me.lboProject.Top + 100)
 
Back
Top