I have an app that loads quite a bit of information in multiple lines in a single row of a ListBox. When you double-click on a row a new window opens and you do stuff in that window. When you exit the window to the previous window, I reload the ListBox with the updated information, but when I do that, the row I previously selected is no longer selected.
I was wondering if there was a way in code to record the current row before moving to the new window and then select that row in code when you return?
If you allow users to change the sort column and direction, you’ll need to store/restore those values too, in which case, you may want to store a unique identifier for the selected row(s) and then reselect them as you reload the data.
row and column are zero-based. The top-left cell is 0,0. Passing -1 as either the Row or Column number means all rows or all columns, respectively. For example, the following specifies all columns in the last row added using AddRow or InsertRow:
Me.Cell(Me.LastIndex, -1)
If you set this equal to a tab-delimited string, you can update the row with one line of code.
I presume you have code that takes the values of the row and populates the fields in the second window. The code to reload the row would be the reverse of that.