Jobs
Author: Juan Ignacio Rios Gutierrez Date Submitted: 4/5/2005 Category: Forms Compatibility: VB 6 This code has been accessed 5886 times.
Email Yourself this snippet:
Option Explicit Dim myScrVal, oldScrVal As Integer Public ContName As String Dim Control As Control
Code
Private Sub Form_Load() VScroll1.Min = -Form1.Height / 2 VScroll1.Max = Form1.Height / 2 VScroll1.Left = Form1.Width - 400 End Sub Private Sub VScroll1_Change() oldScrVal = myScrVal 'Store the old VScroll1.Value myScrVal = VScroll1.Value 'Store the new VScroll1.Value For Each Control In Form1.Controls ContName = Control.Name If Control.Name <> "VScroll1" Then 'to keep the position of th VScroll If myScrVal < oldScrVal Then 'Check when click to scroll up or down Form1.Controls(ContName).Top = Form1.Controls(ContName).Top + 100 'If click to scroll up Else Form1.Controls(ContName).Top = Form1.Controls(ContName).Top - 100 'If click to scroll down End If End If Next Control End Sub