|
-
Apr 11th, 2004, 08:54 AM
#1
Thread Starter
New Member
Remove duplicates from a combo box
this is the code for the listbox
---------------------------------------------------------------------
Dim i As Long
Dim j As Long
With List1
For i = 0 To .ListCount - 1
For j = .ListCount To (i + 1) Step -1
If .List(j) = .List(i) Then
.RemoveItem j
End If
Next
Next
End With
End Sub
---------------------------------------------------------------------
this is the best i can alter the code
---------------------------------------------------------------------
Dim i As Long
Dim j As Long
With cboIUpREF
For i = 0 To .Items.Count - 1
For j = .Items.Count To (i + 1) Step -1
If .Items.Item(j) = .Items.Item(i) Then
.Items.Remove(j)
End If
Next
Next
End With
the line "If .Items.Item(j) = .Items.Item(i) Then" causes an error, what could i change it to, or is there another way other removing dups from a combo box, im using vb.net.
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
|