VB ListBox 添加不重复的值,当列表中已经存在该值即不再添加。
Private Function AddList(List As ListBox, Str As String) As Boolean
Dim I As Long
For I = 0 To List.ListCount - 1
If List.List(I) = Str Then Exit Function
Next
List.AddItem Str
AddList = True
End Function
摘自:网络整理