第1个回答 推荐于2016-09-13
/*我都说了不要RemoveItem 1
拜托 ... 因为那个值会变*/
就是因为值会变,所以才用RemoveItem.
位置会变才要自动判断.
-----------------
哎.搞不懂.
下面是自动判断是代码:
for i=0 to list1.listcount-1
if val(list1.list(i))=444 then
removeitem i
exit for
end if
next i本回答被提问者采纳
第2个回答 2008-01-29
数据不多的话,一个循环完全可以的,数据多就用这个吧
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_FINDSTRING = &H18F
Private Sub Form_Load()
For i = 1 To 9'往list1中加入一些数据以供测试
List1.AddItem String(3, CStr(i))
Next
End Sub
Private Sub Command1_Click()
p$ = InputBox("输入要删除的数据:", "删除", 4)
If Len(p) Then
List1.RemoveItem SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal p)
End If
End Sub