Hello guys!
I have this code:
but this code only select one item. I want to make code which will select multiply items!Code:ListView1.MultiSelect = True ListView1.SelectedItems.Clear() Dim itm As ListViewItem With ListView1 itm = .FindItemWithText(TextBox4.Text, True, 0, True) If Not itm Is Nothing Then For i = 0 To ListView1.Items.Count - 1 .Items.Item(itm.Index).Selected = True Next i itm = Nothing End If End With
Thanks for help!
There is a logic problem on that code, index is a unique property. As far as I can see, you are only getting one index from the first item you find that has the text from the textbox.
So its pointless to select every items with that index because there is only ONE for sure. (useless FOR, its repeating exactly the same every single loop)
New Logic:
Dont forget about the multiselect property of the controlCode:Loop Check If the current item has the text you want If yes, select
Last edited by 'Bruno; 07-18-2012 at 10:51 PM.
Light travels faster than sound. That's why most people seem bright until you hear them speak.