[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
Re: Deleting selecte items in ListBox
Use the following code:
vb Code:
Sub ListBoxRemSel(lst1 As ListBox, lst2 As ListBox, lst3 As ListBox)
Dim j As Integer
For j = lst1.ListCount - 1 To 0 Step -1
If lst1.Selected(j) = True Then
lst1.RemoveItem j
lst2.RemoveItem j
lst3.RemoveItem j
End If
Next
End Sub
Re: Deleting selecte items in ListBox