Scrolling a Frame in the form

Valera_Ned used Ask the Experts™
How can I scroll verticall a frame in the form.
If my form contain a few frames .
For ,example :

How can I scroll Frame3 up to the frame2 (and disapear)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
   Dim lTopPosition As Long
    For lTopPosition = Frame3.Top To Frame2.Top Step -1
        Frame3.Top = lTopPosition
        'Put sleep function here

    Frame3.Visible = False
Note:  You will probably want to put a sleep function in here so you can actually see it happen on a faster machine
Public FrTop1 As Integer, FrTop2 As Integer, FrTop3 As Integer, ScrollNeed As Integer
Private Sub Form_Load()
    FrTop1 = Frame1.Top 'Getting the original position
    FrTop2 = Frame2.Top
    FrTop3 = Frame3.Top
    ScrollNeed = Frame3.Top + Frame3.Height - Me.ScaleHeight ' Getting the full size of the scroll
End Sub

Private Sub VScroll1_Change()
    frNewTop = (ScrollNeed / 100 * VScroll1.Value) ' Getting the new virtual 0 or Top of the form
    Frame1.Top = FrTop1 - frNewTop 'moving the frame
    Frame2.Top = FrTop2 - frNewTop
    Frame3.Top = FrTop3 - frNewTop
End Sub

Valera, do you want scroll the frames with a Scroll Bar or use a visual efect to put a frame over the others?

I sugest to use Tab Dialogs instead the use of scrolling in the form, becouse is too much clean for the user.

Sorry by the grammatical error, I speak spanish. I can talk in English but like Tarzan. Corrections are welcome.
Good Luck.

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


to  twalgrave,
what does it mean to put a sleep function ?


to Deja-vu ,
it's  not working as I wanted it's moving on frame2 and clear it .
And I want that it will slowly disappear
Put this declaration in your code(general declarations):
Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Then call it like:
call Sleep(500) - sleeps for a half second

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial