From Xojo Documentation

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

New in 2021r3

Supported for all project types and targets.

The number of the last row added with the AddRow, AddAllRows or AddRowAt method. 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))