Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture Listview scroll

Status
Not open for further replies.

dr486

Programmer
Jan 9, 2002
105
AU
Hi,

I was wondering if anybody knows how to capture the listview scroll event in Visual Basic

Regards,

dr
 
Start a new public class.. code here.

Code:
Public Class myListView 
Inherits ListView

Private Const SBM_SETSCROLLINFO As Integer = &HE9 
Private Const WM_HSCROLL As Integer = &H115 
Private Const WM_VSCROLL As Integer = &H114 
Public Event Scroll(ByVal sender As Object, ByVal e As EventArgs)

Protected Sub OnScroll()

RaiseEvent Scroll(Me, EventArgs.Empty) 

End Sub

Protected Overrides Sub WndProc(ByRef m As Message)

MyBase.WndProc(m) 
If m.Msg = WM_HSCROLL Or m.Msg = WM_VSCROLL Or m.Msg = SBM_SETSCROLLINFO Then

OnScroll()

End If


End Sub 
End Class

Hope this helps..


jgjge3.gif
[tt]'Very funny, Scotty... Now Beam down my clothes.'[/tt]
 
Is it possible to subclass the control and capture LVM_SCROLL???
 
I think you might actually want to be capturing WM_VSCROLL, but that notwithstanding the answer is yes, you can subclass a ListView
 
My apologies strongm, entirely wrong, need sleep. Taking lessons tomorrow on clicking correct links. ;-)



jgjge3.gif
[tt]'Very funny, Scotty... Now Beam down my clothes.'[/tt]
 
Thanks strongm...WM_VSCROLL worked like a charm

dr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top