|
-
Nov 17th, 2000, 06:56 PM
#1
Thread Starter
Junior Member
I have two listboxes List1 has the numbers from 11 to 99. List2 can hold any of these numbers depending on the user.
My Question is, how can I remove the numbers in list2 from List1 with a commandbutton.
Thanks for your help. Andyb
-
Nov 17th, 2000, 07:11 PM
#2
Frenzied Member
???
Code:
Private Sub Command1_Click()
List1.RemoveItem 5 'the 6th item in the listbox
List1.RemoveItem 5 'the 6th item in the listbox
End Sub
??? Don't know what ya want!?!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 17th, 2000, 07:15 PM
#3
Thread Starter
Junior Member
I want to remove all the items in list2 from list1.
-
Nov 17th, 2000, 07:50 PM
#4
Try the following.
Code:
Private Sub Command1_Click()
For I = 0 To List2.ListCount - 1
For X = 0 To List1.ListCount - 1
If List2.List(I) = List1.List(X) Then List1.RemoveItem (X)
Next X
Next I
End Sub
Private Sub Form_Load()
'Populate List1 with 20 items
For I = 0 To 20
List1.AddItem I
Next I
'Populate List2 with 10 items
For I = 0 To 10
List2.AddItem I
Next I
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|