Solved

Scrolling a Control in VB.Net

Posted on 2006-10-21
2
758 Views
Last Modified: 2011-10-03
I have several controls in a flow-layout panel which can be scrolled vertically. I dont want to scroll the flow-layout panel using mouse but it should scroll down when i click a button. How to do that?

Any hint?
0
Comment
Question by:biplavo
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 17782626
You use the SendMessage() API with the WM_VSCROLL msg.  You can go up/down by line or by page:

Public Class TestForm

    Public Const WM_VSCROLL As Integer = &H115
    Public Const SB_LINEUP As Integer = 0
    Public Const SB_LINEDOWN As Integer = 1
    Public Const SB_PAGEUP As Integer = 2
    Public Const SB_PAGEDOWN As Integer = 3

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
      (ByVal Handle As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'SendMessage(Me.FlowLayoutPanel1.Handle, WM_VSCROLL, SB_PAGEUP, 0)
        SendMessage(Me.FlowLayoutPanel1.Handle, WM_VSCROLL, SB_LINEUP, 0)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'SendMessage(Me.FlowLayoutPanel1.Handle, WM_VSCROLL, SB_PAGEDOWN, 0)
        SendMessage(Me.FlowLayoutPanel1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)
    End Sub

End Class



You can also set the AutoScrollPosition() property of the FlowLayoutPanel...
0
 
LVL 10

Expert Comment

by:gangwisch
ID: 17785851
also there is a
flowlayoutcontrol1.scrollcontrolintoview(label1)
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

Suggested Solutions

Title # Comments Views Activity
Tabcontrol Caption? 1 30
Code enhancement 5 23
Changing the Source of an ADO Recordset while it's open 4 37
Need a starter for ETL protocol? 4 42
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

16 Experts available now in Live!

Get 1:1 Help Now