Scrolling listbox row to top

I have a Listbox with about 300 rows of data. The first column is a date, and there are several rows with the same date.

Using a date picker, I have a button for the user to find the first row with the chosen date and make that editable. I do this using EditCellAt. The selected row is displayed as the last row in the LB window (which is usually not the last row in the LB)

What I need to do is to scroll the data rows so that the selected row is at the top of the Listbox window.

Does anyone know how I can do this please

Thanks in advance

I haven’t used it yet but I think you need https://documentation.xojo.com/api/deprecated/listbox.html#listbox-scrollposition

Listbox.ScrollPosition = Listbox.SelectedRowIndex

1 Like

Thank you Mark - that works a treat! I’d never have found that as there is nothing in the name LB.scrollposition to indicate it is returns the top visible row, though that is of course in the documentation.

Thanks again

1 Like

Absolutely right, and thanks for the reply. See my reply to Mark, below