Solved

Scrolling a Control in VB.Net

Posted on 2006-10-21
2
765 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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