[Gambas-user] Filtering listbox list
T Lee Davidson
t.lee.davidson at gmail.com
Sun Mar 11 19:37:24 CET 2018
Good advice on using ListBox.List.Max.
I have found the KeyRelease event to be more reliable in regards to having access to the actual, current keystroke value.
And, instead of looping through List, I personally would simply use ListBox.Find.
--
Lee
On 03/11/2018 09:37 AM, Gianluigi wrote:
> Maybe you could use the KeyPress event with "If Key.Code = Key.Return Then ...",
> "Inc i" is useless and you should use ListBox1.List.Max (or ListBox1.count -1) instead of ListBox1.Count to avoid the 'out of
> bound' error.
>
> Regards
> Gianluigi
>
> 2018-03-11 10:33 GMT+01:00 Shannon Kuchler <shannon at inflecto.org <mailto:shannon at inflecto.org>>:
>
> __
>
>
>
> -I think I figured it out
>
>
> Public Sub TextBox4_KeyRelease()
> Dim i As Integer
> Dim l As Integer
>
> ListBox6.Clear
>
>
> If TextBox4.text > "z" Or TextBox4.text < " " Then Return
> For l = 0 To ListBox1.Count
> Inc i
> If ListBox1[i].Text Like TextBox4.Text & "*" Then ' found another
> ListBox6.Add(ListBox1[i].Text)
> Endif
> Next
>
> End
>
>
>
More information about the User
mailing list