Solved

Scrolling a Control in VB.Net

Posted on 2006-10-21
2
763 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 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