My.Computer.Mouse.WheelScrollLines Property 

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

Return Value

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.

Exceptions

The following conditions can cause an exception:

  • The computer has no mouse installed (InvalidOperationException).

  • The mouse has no scroll wheel (InvalidOperationException).

Remarks

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.

Example

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

Requirements

Namespace: Microsoft.VisualBasic.Devices

Class: Mouse

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

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

Permissions

No permissions are required.

See Also

Reference

My.Computer.Mouse Object
My.Computer.Mouse.WheelExists Property
Microsoft.VisualBasic.Devices.Mouse.WheelScrollLines