How can I remove the item I double click in a listview box ?
Printable View
How can I remove the item I double click in a listview box ?
i think without testing it
listview.listItem(listview.selectedItem.index).Remove
VB Code:
Private Sub ListView1_DblClick() On Error Resume Next Dim i As Long For i = 1 To ListView1.ListItems.Count If ListView1.ListItems(i).Selected = True Then ListView1.ListItems.Remove i End If Next End Sub
sorry i was close
lst.ListItems.Remove lst.SelectedItem.Index
hack would you really loop thru 1000 item each time!!!
if you want to make sure it's not empty
if not lst.lisitems.count then lst.ListItems.Remove lst.SelectedItem.Index
Ooh...good point sebs
I use that code, generally from a command button, when the user has selected multiple items. I just cut 'n pasted it into a double click event. Brain fart on my part!
nmretd: Use sebs code instead!