注册 登录
编程论坛 VB6论坛

新手求教···关于重复数据过滤,删除多余的··

anluboy 发布于 2013-05-26 10:32, 482 次点击
我要提取某页面的连接···
Private Sub Command1_Click()
List1.Clear
For Each ww In WebBrowser1.Document.getElementsByTagName("a")
ss = ww.href
If right(ss, 5) = "shtml" Then
List1.AddItem ss
Frame5.Caption = "共提取到:" & List1.ListCount & "条连接"
End If
Next ww
End Sub
如何删除listbox里的重复项? listbox 里现有多条重复值,如何能才把所有重复数据删除?
例:现listbox里以下大量数据  
http://www.baidu.com/
http://www.baidu.com/123.htm
http://www.
http://www.baidu.com/
http://www.
http://www.baidu.com/
http://www.baidu.com/123.htm
…………………
我现在需要把所有重复的数据删除:得到:
http://www.baidu.com/
http://www.baidu.com/123.htm
http://www.
http://www.
…………这样完会没有重复的
应该怎么做?
请给出例子··谢谢···
2 回复
#2
Artless2013-05-26 11:05
Private Sub Command1_Click()
Dim i As Long
Dim l As Boolean
List1.Clear
For Each ww In WebBrowser1.Document.getElementsByTagName("a")
ss = ww.href
If right(ss, 5) = "shtml" Then
l = True
For i = 0 To List1.ListCount - 1
    If ss = List1.List(i) Then
        l = False
        Exit For
    End If
Next
If l Then list1.AddItem ss
Frame5.Caption = "共提取到:" & List1.ListCount & "条连接"
End If
Next ww
End Sub
#3
anluboy2013-05-26 17:44
谢谢·
1