Solved

scrolling scroll bar by code

Posted on 2002-07-02
4
187 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 142

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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now