locating row number from object in celltag

I am using a class like “ownListRow” to store values of a listbox-row. This ownListRow gets stored in the rowTag of each row. It is then possible to access the values of the object directly, without having to know, wich row number the object is stored. That works so far. But is there a way to locate the row number, where the object is stored in? Thanks!

For i As Integer = 0 To lbx.ListCount - 1 If lbx.RowTag(i) Is ownListRowInstance Then // found Exit End Next
This assumes that the row tags of all rows have a ownListRow instance.

thanks Eli. I was hoping for a more elegant solution, where you don’t have to scan the entire Listbox, but this definitely does the job. Thanks again!

Well, the ListBox has RowFromXY - see http://documentation.xojo.com/index.php/ListBox.RowFromXY