From Xojo Documentation


PopupMenu.RowTag(Index as Integer) As Variant

Supported for all project types and targets.

A "hidden" identifier associated with the item identified by the Row parameter. The first row is numbered zero.


If you want to compare the value of RowTag to another value, you must first convert the value of RowTag to that data type.


This example populates the RowTag identifier with a sequence number.

Dim nItems As Integer
nItems = Me.ListCount - 1
For i As Integer = 0 To nItems
Me.RowTag(i) = i

Since RowTag is a Variant, you must first convert it to an Integer if you want to compare it to another integer. Do this with a simple assignment statement such as:

Dim recID As Integer
recID = ComboBox1.RowTag(1) // ComboBox inherits from PopupMenu so it also inherits the RowTag method

You can also use the CType function to do an explicit conversion to any other datatype. Then compare recID to another Integer.

Displaying the RowTag of the selected menu item:

TextField1.Text = ComboBox1.RowTag(ComboBox1.ListIndex)