Solved

scrolling scroll bar by code

Posted on 2002-07-02
4
191 Views
Last Modified: 2010-05-02
i have a mdi form which contain a child form,i wish to know how can i use coding to move the scroll bar of the mdi form so the user no need to use mouse to scroll down manually to see the whole content of the child form.. please gave me some example to refer to.. Thanks
0
Comment
Question by:tayleeming
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7124330
What about this example (code for the MDI Child):

Private Sub Form_DblClick()
  Me.Top = 0
  Me.Left = 0
End Sub

CHeers
0
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 50 total points
ID: 7126062
Try use SendMessage API:

use the SendMessage API to scroll the form to top:

http://www.mvps.org/vbnet/code/subclass/lvscrollbars.htm

Basically, what you should look is the:

Private Const SB_LINEUP = 0
Private Const SB_LINEDOWN = 1
Private Const SB_PAGEUP = 2
Private Const SB_PAGEDOWN = 3
Private Const SB_THUMBPOSITION = 4
Private Const SB_THUMBTRACK = 5
Private Const SB_TOP = 6
Private Const SB_BOTTOM = 7
Private Const SB_ENDSCROLL = 8

Private Declare Function SendMessage Lib "user32" _
  Alias "SendMessageA" _
 (ByVal hWnd As Long, _
  ByVal wMsg As Long, _
  ByVal wParam As Long, _
  lParam As Any) As Long

and

Call SendMessage(ListView2.hWnd, _
                            WM_VSCROLL, _
                            wParam, _
                            ByVal 0&)
Modify the parameter to

Call SendMessage(FormName.hWnd, _
                            WM_VSCROLL, _
                            B_BOTTOM , _
                            ByVal 0&)


Hope this helps
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7971214
Hi tayleeming,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept ryancys's comment(s) as an answer.

tayleeming, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8018740
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question