?
Solved

Scrolling a Control in VB.Net

Posted on 2006-10-21
2
Medium Priority
?
766 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

741 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