Hi,
First of all try to use the insert code tags, makes reading code much easier.
I was looking at your code and noticed a lot of variables being assigned for no good reason. I just typed a bit of code that perhaps could help you.
dim s as string = TextField1.text.trim // Valor a buscar
// Existe algo que buscar y la lista tiene items?
if listbox1.ListCount = 0 then
exit
end if
if s.len = 0 then
listbox1.ListIndex = -1
exit
end if
dim i as integer
for i = 0 to (listbox1.ListCount -1)
if InStr(0, listbox1.Cell(i,0), s) > 0 then
listbox1.ListIndex = i
exit for i // Se encontro lo que se buscaba, ahora hay que salir
end if
next i
Personally I would move the code to a method, I don't like placing code in any action events, what I do is either call a function or a method from the action event, this allows you to call your function from somewhere else in your code if needed.