Hi,
i just want to compare 2 listboxes. The comparison should be like this..that if the item present in the first list box is not present in the second list box, the item must be removed from the first list box. could you please me......
Anand
Here's a quick attempt at some VB6 code.
- Dim Found as Boolean
-
For I = list1.listcount - 1 To 0 Step -1
-
Found = False
-
For J = 0 to list2.listcount - 1
-
If list2.list(J) = list1.list(I) Then
-
Found = True
-
Exit For
-
End If
-
Next
-
If Not Found Then
-
List1.RemoveItem I
-
End If
-
Next
-
That should be enough to get you started, anyway - it's just straight off the top of my head, so may need debugging.
And if you're using Vb.Net then my syntax may be all wrong, but the logic should still apply. If you're using VBA in Access or something, then all bets are off.