Solved

scrolling scroll bar by code

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

17 Experts available now in Live!

Get 1:1 Help Now