Private Function Exists(objCmb As ComboBox, ByVal strTmp As String) As Boolean
Exists = False
Dim i As Long
For i = 0 To objCmb.ListCount - 1
If objCmb.List(i) = strTmp Then
Exists = True
Exit For
End If
Next
End Function
调用方法:
假设你要把Text1的内容往url(ComboBox)里添加
If Not Exists(url,Text1.Text) Then url.AddItem Text1.Text