Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets a number that indicates how much to scroll when the mouse wheel is rotated one notch.
' Usage
Dim value As Integer = My.Computer.Mouse.WheelScrollLines
' Declaration
Public ReadOnly Property WheelScrollLines As Integer
An Integer that indicates how much to scroll when the mouse wheel is rotated one notch. A positive value indicates scrolling by that number of lines, while a negative value indicates scrolling by one screen at a time.
The following conditions can cause an exception:
The computer has no mouse installed (InvalidOperationException).
The mouse has no scroll wheel (InvalidOperationException).
You can use this property to determine how many lines to scroll up or down in a multi-line control that has a scroll bar.
The My.Computer.Mouse.WheelScrollLines property provides functionality similar to the MouseWheelScrollLines property.
Because this property throws an exception if the mouse does not have a scroll wheel, you should make sure a mouse has a scroll wheel by checking the My.Computer.Mouse.WheelExists property.
This property provides information about the computer that runs the code.
This example determines if the mouse has a scroll wheel and uses the My.Computer.Mouse.WheelExists property to determine how much to scroll when the mouse wheel is rotated.
If My.Computer.Mouse.WheelExists Then
Dim lines As Integer = My.Computer.Mouse.WheelScrollLines
If lines > 0 Then
MsgBox("Application scrolls " & _
lines & " line(s) for each wheel turn.")
Else
MsgBox("Application scrolls " & _
(-lines) & " page(s) for each wheel turn.")
End If
Else
MsgBox("Mouse has no scroll wheel.")
End If
Namespace:Microsoft.VisualBasic.Devices
Class:Mouse
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Project type |
Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
No |
Windows Service |
Yes |
Web Site |
No |
No permissions are required.
Please sign in to use this experience.
Sign in