MouseRowfunction
Returns the current mouse position, in row coordinate.
Syntax
FUNCTION MouseRow () AS LONG
Description
Returns the zero-based index of the row under the mouse pointer.
Remarks
Unlike the Row property (which indicates the selected or active row), MouseRo updates as the user moves the mouse, regardless of whether they click.
It translates the mouse's vertical pixel position into a grid row index.
If the mouse is over a fixed header row, MouseRow will return the index of that header (e.g., 0 for the first header row).
If the mouse is over a data row, the returned value corresponds to that row’s index.
If the mouse is within the control but below the last populated row, it typically returns -1.
Internally, the control converts the mouse’s vertical pixel coordinate into a row index using its row‑height table. This means the result is always based on the visual layout, not on the underlying Recordset.
Example
Dim hoverRow As Long = grid.MouseRow ' Ensure the mouse is over a valid data row (not header or empty space) If hoverRow >= grid.FixedRows Then Print "Hovering over: " & grid.TextMatrix(hoverRow, 0) End If
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid