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

呵呵,问题不一样啊
2025-02-24 02:21:19
推荐回答(3个)
回答1:

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)

回答2:

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

呵呵 刚回答完

回答3:

楼上的方法很好啊!!