Solved

Scrolling a Control in VB.Net

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

24 Experts available now in Live!

Get 1:1 Help Now