vb中如何实现单击command1输入一个数据并向list1中添加它,如果list1中该数据重复就不添加?

来源:百度知道 编辑:UC知道 时间:2024/05/26 18:12:32
呵呵,问题不一样啊

command1代码:
Dim x As String, i As Integer, s As Boolean
x = InputBox("请输入一个数:")
If List1.ListCount = 0 Then List1.AddItem (x)
s = True
For i = 0 To List1.ListCount - 1
If List1.List(i) = x Then
s = False
Exit For
End If
Next
If s Then List1.AddItem (x)

http://zhidao.baidu.com/question/120486056.html

呵呵 刚回答完

楼上的方法很好啊!!