VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1

by Juan Ignacio Rios Gutierrez (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 4th May 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1

API Declarations


Dim myScrVal, oldScrVal As Integer
Public ContName As String
Dim Control As Control


Rate Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1




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


Download this snippet    Add to My Saved Code

Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1 Comments

No comments have been posted about Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1. Why not be the first to post a comment about Scrollable Form. You need at least one object (TextBox, Label, etc) plus a VScroll named VScroll1.

Post your comment

Subject:
Message:
0/1000 characters