My.Computer.Mouse.WheelExists Property
Gets a Boolean that indicates if the mouse has a scroll wheel.
' Usage
Dim value As Boolean = My.Computer.Mouse.WheelExists
' Declaration
Public ReadOnly Property WheelExists As Boolean
Property Value
A Boolean with value True if the mouse has a scroll wheel; otherwise False.
Exceptions
The following condition can cause an exception:
- The computer has no mouse installed (InvalidOperationException).
Remarks
The My.Computer.Mouse.WheelExists property provides functionality similar to the MouseWheelPresent property.
You should check the value of the My.Computer.Mouse.WheelExists property before attempting to access the My.Computer.Mouse.WheelScrollLines Property, which throws an exception if the mouse does not have a scroll wheel.
The My.Computer.Mouse.WheelExists property provides information about the computer that runs the code.
Example
This example uses the My.Computer.Mouse.WheelExists property to determine if the mouse has a scroll wheel and 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.