ListBox compile error

I’m having a problem compiling code involving ListBox.Selected which is used in the ListBox.Change event handler. The relevant code fragment is:

dim SelectIndex As integer
SelectIndex = me.Selected

The second line produces the compiler error “There is more than one item with this name and it’s not clear to which this refers.” I’ve tried changing to other ListBox properties (me.Value, for example) without error, so the offender seems to be the Selected property. This is with Xojo 2016 R3 on macOS 10.12.

Any suggestions?

Selected is a method taking one argument, the row index:

Dim isRow23Selected As Boolean = Me.Selected(23)

If you want to know the currently selected row use ListIndex:

Dim selectIndex As Integer = Me.ListIndex

Check the LR for the details.

ListBox.SelCount exists, so .Selected(Row_Nbr) can be true for far more than one Row #.

Remember this when you’re back to coding.

Thanks guys - I knew this had to be a simple mistake on my part but I couldn’t see the obvious!