Results 1 to 5 of 5

Thread: Removing Items From List View Box

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Removing Items From List View Box

    How can I remove the item I double click in a listview box ?

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    i think without testing it

    listview.listItem(listview.selectedItem.index).Remove

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Sub ListView1_DblClick()
    2. On Error Resume Next
    3. Dim i As Long
    4.   For i = 1 To ListView1.ListItems.Count
    5.       If ListView1.ListItems(i).Selected = True Then
    6.          ListView1.ListItems.Remove i
    7.       End If
    8.   Next
    9. End Sub

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    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

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width