how to add to the top of the listview

nkd

New member
Joined
Mar 21, 2008
Messages
2
Programming Experience
1-3
I have added a listview control to the form
the line
listview1.items.add("item1")
adds the item1 to the end of the list. I want to add it to the top of the list.
If I use the insert method as under, there is a problem :-
listview1.items.insert(1,"item1")
it inserts the item1 at the first position , but clicking on the check box against it now controls the previous item that was at that position ! so although the item got inserted but somehow the links are still not correct !

how can I set it right ?
thanks in advance
ni****h
 
listview1.items.insert(1,"item1")
it inserts the item1 at the first position
No, 0 is first.
ListView.ListViewItemCollection.Insert Method (Int32, String)

index
The zero-based index location where the item is inserted.
but clicking on the check box against it now controls the previous item that was at that position
??? Does the first info sort this out for you also?
 
yeah thanks that was gr8 john
there was one more problem which I solved - I used the tag property of the list item to connect the item to the relevant object.
thanks once again
ni****h
 
Back
Top