Results 1 to 3 of 3

Thread: [RESOLVED] Deleting selecte items in ListBox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    76

    Resolved [RESOLVED] Deleting selecte items in ListBox

    Hello guys, I have this frustrating problem, I have 3 list box, 1st is for itemName, 2nd is for Quantity, and 3rd is for Price.. How can I Delete the itemName in the listbox and at the same delete the price and quantity. All I can do is to delete a single selected ItemName, but I can't delete the price and quantity. here's my code
    Code:
    Private Sub btnDelete_Click()
    Call ListBoxRemSel(lstItem)
    End Sub
    
    
    
    Sub ListBoxRemSel(lst As ListBox)
    Dim a As Integer
       Do Until lst.SelCount = 0
           If lst.Selected(a) Then lst.RemoveItem a: a = a - 1
           a = a + 1
       Loop
    End Sub

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Deleting selecte items in ListBox

    Use the following code:

    vb Code:
    1. Sub ListBoxRemSel(lst1 As ListBox, lst2 As ListBox, lst3 As ListBox)
    2.    
    3.     Dim j As Integer
    4.    
    5.     For j = lst1.ListCount - 1 To 0 Step -1
    6.         If lst1.Selected(j) = True Then
    7.             lst1.RemoveItem j
    8.             lst2.RemoveItem j
    9.             lst3.RemoveItem j
    10.         End If
    11.     Next
    12.    
    13. End Sub



  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    76

    Re: Deleting selecte items in ListBox

    thanks a lot.. it works.

Tags for this Thread

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