I found this bit of code on the forums a few weeks ago from @MarkusR i believe? (Cant find the post)
It loops through a listbox and highlights the row that matches the text in the textfield.
Textfield (TextChanged) event:
Pressed() if TextField1.text = "" then Listbox1.SelectedRowIndex = ListBox1.NoSelection end if
Two methods created:
Method 1 - Name = (Pressed)
Method 2 - Name = (Search)
System.DebugLog CurrentMethodName Var lb As Listbox = Listbox1 For row As Integer = 0 To lb.LastRowIndex Var found As Boolean = False For col As Integer = 0 To lb.ColumnCount-1 Var s As String = lb.CellValueAt(row,col) If s.IndexOf(0, tx, ComparisonOptions.CaseInsensitive) >= 0 Then found = True End If Next lb.Selected(row) = found Next
As you can see from the gif above (Hopefully) when searching for a row that is out of view, I have to scroll manually to that position.
My question, is there anything I could add to the above code to do make it bring the selected row into view automatically?
Thank you in advanced!