ListBox.HitTest
- Updated2025-07-21
- 1 minute(s) read
ListBox.HitTest
Syntax
ListBox.HitTest( x, y)
Return Value
Returns a numeric item index.
Purpose
Returns the index of the item at the given coordinates. Returns -1 when no item exists at the specified coordinates.
Remarks
Use this method to determine the item at the given coordinates. For example, when a user clicks on the control, you can determine the item the user clicked.
Parameters
x As Long
[In] Specifies the x-coordinate of the location to test, in pixels, relative to the control.
y As Long
[In] Specifies the y-coordinate of the location to test, in pixels, relative to the control.