# VBForums CodeBank > CodeBank - C# >  list view scroll event for popskie or anyone else who wants it

## MrPolite

ugh I dont remember who, but a long while ago someone in the api forum told me the correct wm message for this (hack or megatron I assume  :Big Grin: )

Here's a sample. I'm using this class instead of listview. Note that it's not a perfect solution, as the scroll event is raised for any key that's pressed in the listview (optimally you want to check for the arrow keys only), and it's also raised with a mouse scroll event (even if the list doesnt scroll.... but still it's a good enough solution

here's the class:


```
using System.Windows.Forms;

public class ListViewEx:ListView
{
	private const int WM_HSCROLL	= 0x0114;
	private const int WM_VSCROLL    = 0x0115;
	private const int WM_KEYDOWN    = 0x0100;
	private const int WM_MOUSEWHEEL = 0x020A;

	public event System.EventHandler ScrollEvent;
		
	protected override void WndProc(ref Message m)
	{
		if (m.Msg == WM_VSCROLL  || 
			m.Msg == WM_HSCROLL  ||
			m.Msg == WM_KEYDOWN	 ||
			m.Msg == WM_MOUSEWHEEL)
			if (ScrollEvent != null)
				ScrollEvent (this, null);


		base.WndProc (ref m);
	}

}
```

and see the sample project if you want

----------


## Hack

Moved to C# CodeBank.

----------

