[Gambas-user] Filtering listbox list
T Lee Davidson
t.lee.davidson at gmail.com
Sun Mar 11 22:54:43 CET 2018
On 03/11/2018 05:03 PM, Shannon Kuchler wrote:
> This code works
>
>
> Public Sub TextBox4_KeyRelease()
>
> Dim i As Integer
> Dim l As Integer
> i = (-1)
>
> ListBox6.Clear
>
> If TextBox4.Text = "" Then ListBox6.List = ListBox1.List
> If TextBox4.Text <= " " Then Return ' not searchable
> For l = 0 To ListBox1.List.Max
> Inc i
> If ListBox1[i].Text Like TextBox4.Text & "*" Then ' found another
> ListBox6.Add(ListBox1[i].Text)
> Endif
> Next
>
> end
So does this:
Public Sub TextBox4_KeyRelease()
Dim ndx As Integer
ListBox6.Clear
If TextBox4.Text = "" Then ListBox6.List = ListBox4.List
If TextBox4.Text <= " " Then Return ' not searchable
ndx = ListBox4.Find("*" & TextBox4.Text & "*", gb.Like)
While ndx >= 0 ' found another
ListBox6.Add(ListBox4[ndx].Text)
ndx = ListBox4.List.Find("*" & TextBox4.Text & "*", gb.Like, ndx + 1)
Wend
End
:-)
--
Lee
More information about the User
mailing list