
Originally Posted by
June7
Well, I learned something new.
Want to show the code you use?
Mark thread solved with Thread Tools above the first post.
Code:
'MsgBox "DefaultHeight=" & Me.InsideHeight & " DefaultWidth=" & Me.InsideWidth & _
' " VerticalAdjust=" & Me.InsideHeight - lstSalesOrders.Height & _
' " HorizontalAdjust=" & Me.InsideWidth - lstSalesOrders.Width & _
' " ButtonAdjust=" & cmdOpen.Top - lstSalesOrders.Height - lstSalesOrders.Top
If Me.InsideHeight < 8625 And Me.InsideHeight > 1065 Then
lstSalesOrders.Height = Me.InsideHeight - 1065
Dim intButtonPosition As Integer
intButtonPosition = lstSalesOrders.Height + lstSalesOrders.Top + 120
cmdDuplicate.Top = intButtonPosition
cmdOpen.Top = intButtonPosition
cmdCancel.Top = intButtonPosition
End If
If Me.InsideWidth < 5400 And Me.InsideWidth > 420 Then
lstSalesOrders.Width = Me.InsideWidth - 420
End If
So this basically says, if the form is smaller than the default size, then resize the listbox to be a constant amount smaller than the form size. (1065 fewer units vertically and 420 units horizontally). I used message box output to tell me what the constant values were. I had to move three buttons as I resized as well (cmdDuplicate, cmdOpen, cmdCancel). I just plunked this in form.onresize. Thanks again for the help.