perryni
perryni

Reputation: 35

Mousewheel Event

I have got as form with a vertical scroll bar, I want to use the mouse wheel to scroll up and down the form but I cant seem to get to get the mousewheel event to fire.

I just use the standard mousewheel event

Private Sub frmTest_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel

'code here

End Sub

Any help would be appreciated.

Upvotes: 1

Views: 5229

Answers (1)

spajce
spajce

Reputation: 7082

Try to place a one Panel in your Form set to AutoScroll = true, Dock = Fill and from the Panel place all your control like TextBox, label, listView etc..

  Private Sub Panel1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles Panel1.MouseEnter
        Panel1.Focus()
  End Sub

  Private Sub Panel1_MouseWheel(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseWheel
        MessageBox.Show("okay")
  End Sub

Upvotes: 3

Related Questions