How do I cycle through the items in a ListView1?

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
User avatar
gambafeliz
Posts: 141
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

How do I cycle through the items in a ListView1?

Post by gambafeliz »

Hi

How do I cycle through the items in a ListView1?

I load them with key and value with ADD. And what I want to do is loop through the values of all the rows to change the color as the user types text that is equal to the value.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
User avatar
gambafeliz
Posts: 141
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

Re: How do I cycle through the items in a ListView1?

Post by gambafeliz »

My solution:

Public Sub txtFind_KeyRelease()
   
   For Each key As Integer In ListView1.Keys
      If String.InStr(UCase(ListView1[key].Text), UCase(txtFind.Text)) <> 0 Then
         ListView1[key].Foreground = Color.Blue
      Else
         ListView1[key].Foreground = Color.Default
      Endif
   Next
   ListView1.Refresh
   
End
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Post Reply