After searching the the world over I found a lead here at VB-World on how to create scrolling forms. I know that the code is slightly inefficient but it gets the job done.
Insert this code onto the form module:
This code goes in Form_loadCode:Dim intLastPoz As Integer
Public Sub ScrollForm()
Dim ctl As Control
'Use carriage returns as needed here.
'Type NOSCROLL in the .Tag property of the control to keep
'the control from scrolling.
For Each ctl In frm3.Controls
If ctl.Tag <> "NOSCROLL" And Not (TypeOf ctl Is VScrollBar) _
And Not (TypeOf ctl Is Timer) Then _
ctl.Top = ctl.Top + intLastPoz - VScroll1.Value
Next ctl
'to create a horizontally scrolling form use .Left instead
'of .Top in the above loop.
intLastPoz = VScroll1.Value
End Sub
Private Sub VScroll1_Change()
ScrollForm
End Sub
Private Sub VScroll1_Scroll()
ScrollForm
End Sub
I found out from trial and error that ScrollForm loop will not scroll a timer control so I added on to the code that I found here (I believe by Karl Moore).Code:Dim intFullHeight As Integer
Dim intDisplayHeight As Integer
'Change these as needed
intFullHeight = 9000
intDisplayHeight = 5040
frm3.Height = intDisplayHeight
With VScroll1 'name of the vertical scrollbar
.Height = frm3.ScaleHeight
.Min = 0
.Max = intFullHeight - intDisplayHeight
'change the 10 to a larger number to create a faster scroll
.SmallChange = Screen.TwipsPerPixelX * 10
.LargeChange = .SmallChange
End With
When I scroll the controls on the form disappear under the form's title bar. Is there a way to make the controls disappear under the columns titles (like the freezeframe in excel)? I suspect that I could use a borderless frame to scroll a specific area on the form. Would anyone care to share the How-To on creating a scrolling frame?
Flint
Quote:
A person who walks in another's tracks leaves no footsteps.
