@Eli Ott
Thank you for the rapid response. Since making my last post I realised that the timer that I had instantiated was falling out of scope following the end of the loop. This indicated to me that it had been destroyed before it could actually execute.
I proved this by making the timer outside of the loop (and, indeed, the method). Then it executed and the correct listbox item record was highlighted and displayed. So I have solved my problem. I had to play a bit with the timer period as, initially, it looked like quite a delay before ‘refreshing’ the listbox. However, I found that a period of 250 gave me an acceptable response.
I would like to pick up on the last point you made. Namely:
That is what I was doing originally. If you look at the code I posted:
For lp As Integer = 0 To me.ListCount - 1
If Me.RowTag(lp) = ac.mKey Then
System.DebugLog "Setting up timer."
System.DebugLog "Current List Index : " + Str(me.listindex)
System.DebugLog "New List Index : " + Str(lp)
Dim tmr As New slbResetRow
tmr.LBox = Me
tmr.RowID = lp
tmr.Mode = timer.ModeSingle
tmr.Enabled = True
' Me.listindex = lp
' Me.Selected(lp) = True
Exit For
End If
Next
And remove the timer code and uncomment one line you will see my original code:
For lp As Integer = 0 To me.ListCount - 1
If Me.RowTag(lp) = ac.mKey Then
Me.listindex = lp
Exit For
End If
Next
The above was my original code - exactly what you described!
It was because this did not work that I attached my issue to this thread. But the timer solution has solved it.
Unless - anybody has any better ideas!