From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aPopupMenu.LastAddedRowIndex

New in 2019r2

Supported for all project types and targets.

The number of the last row added with the AddRow, AddAllRows or AddRowAt method. LastAddedRowIndex is zero-based. If no rows have been added, LastAddedRowIndex will be -1.


This example displays the value of the last row added to the popup menu:

Var r As Integer = PopupMenu1.LastAddedRowIndex
MessageBox("The last value added was: " + PopupMenu1.RowValueAt(r))