请问list里添加不重复的数据
vb吧
全部回复
仅看楼主
level 1
115497282 楼主
2006年05月25日 23点05分 1
level 11
VB程序设计交流群 5065880
2006年05月26日 00点05分 2
level 6
从第一条数据循环到最后一条,判断是否重复.如果不重复插入数据subInsert(newData as string)dim i as integerfor i=0 to list1.listcount-1 '重复结束过程,不插入数据 if newData<>list1.list(i) then goto: bTrue end ifnext'不重复,插入数据list1.additem newData'重复标号bTrue:end sub
2006年05月26日 02点05分 3
效率太低,建议参考类似散列表的方法,维护每一项的hashcode
2014年12月27日 15点12分
level 6
上面判断条件写错了,重来Sub Insert(newData As String)Dim i As IntegerFor i = 0 To List1.ListCount - 1 '重复结束过程,不插入数据 If newData = List1.List(i) Then GoTo bTrue End IfNext'不重复,插入数据List1.AddItem newData'重复标号bTrue:End Sub
2006年05月26日 02点05分 4
level 11
VB群 5065880
2006年05月26日 02点05分 5
level 15
网上有
2014年12月27日 09点12分 7
level 13
一个常量
Const LB_FINDSTRING = &H18F
发送消息立马能检测要添加的数据是否已存在 一行代码搞定 还循环啥?
2014年12月27日 09点12分 8
1