Click to See Complete Forum and Search --> : listview
vin
October 23rd, 2001, 09:09 AM
Hi,
I have a listview and I add items like this
myLV.AddItem ,"k1", "Hello"
myLV.AddItem ,"k2", "Hi"
myLV.AddItem ,"k2", "etc."
...
then I want to find an item using the key.
I realize I can iterate all items one by one,
but is there faster way to find an item by key?
thanks.
Valery Iskarov Nikolov
Software Dynamics
DSJ
October 23rd, 2001, 09:46 AM
What listview control are you using? The one I have (Microsoft's) doesn't have an AddItem method???
vin
October 23rd, 2001, 09:54 AM
ok, my mistake, in my post instead of
myLV.AddItem ,"k1", "Hello"
myLV.AddItem ,"k2", "Hi"
myLV.AddItem ,"k2", "etc."
I should have written
myLV.ListItems.Add ,"k1", "Hello"
myLV.ListItems.Add ,"k2", "Hi"
myLV.ListItems.Add ,"k2", "etc."
Valery Iskarov Nikolov
Software Dynamics
DSJ
October 23rd, 2001, 10:13 AM
I think it can be used interchangeably anytime you would normally use the "index" parameter as in:
private Sub Command1_Click()
MsgBox ListView1.ListItems("K2").Text
End Sub
private Sub Form_Load()
ListView1.ListItems.Add , "K1", "One"
ListView1.ListItems.Add , "K2", "Two"
ListView1.ListItems.Add , "K3", "Three"
End Sub
vin
October 23rd, 2001, 10:25 AM
You are quite right,
Thanks,
Valery Iskarov Nikolov
Software Dynamics
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.