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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make the form to scroll 1

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
Does any one knows how to make the form to scroll? Do I need to add a scroll bar on the form and how can I make the scroll bar to scroll when I make the form smaller and larger?

Many thanks
 
Yes, you'll need to add a scrollbar to the form, and to make it scroll when you make the form smaller and larger, put that code in the Form_Resize event. You'll probably need an On Error Resume Next statement in the Form_Resize in case the form is resized too quickly.

-Mike
 
Hi, MikeCox
What exectly code do I need to write to program the scrollbar? Can you copy and paste the code on the forum?

Many thanks
 
This should get you started:

Private Sub Form_Load()
VScroll1.Max = Me.Height
VScroll1.Value = 0

End Sub

Private Sub VScroll1_Scroll()
Me.CurrentX = 10
Me.CurrentY = VScroll1.Max - VScroll1.Value
Me.Refresh
Print VScroll1.Value

End Sub


Notice you can change the .Min and .Max properties of VScroll1, use this to your advantage instead of trying to play with erroneous numbers. This also goes for progress bars, BTW.

Good luck!

-Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top