第2个回答 2019-10-20
Private
Sub
Command1_Click()
List1.Clear
Dim
S()
S
=
Array("A",
"B",
"C",
"D",
"AB",
"AC",
"AD",
"BC",
"BD",
"CD",
"ABC",
"ABD",
"ACD",
"BCD",
"ABCD")
Dim
i
As
Integer
For
i
=
LBound(S)
To
UBound(S)
List1.AddItem
S(i)
Next
i
Label2.Caption
=
"当前有
"
&
List1.ListCount
&
"
条数据!"
End
Sub
Private
Sub
Command2_Click()
Dim
i
As
Integer
Label1.Caption
=
"下列值已被删除!"
For
i
=
List1.ListCount
-
1
To
0
Step
-1
If
InStr(List1.List(i),
"BC")
>
0
Then
Label1.Caption
=
Label1.Caption
&
vbCrLf
&
List1.List(i)
List1.RemoveItem
i
End
If
Next
i
Label2.Caption
=
"当前有
"
&
List1.ListCount
&
"
条数据!"
End
Sub
第5个回答 2019-08-07
like也能实现。
Private
Sub
Command1_Click()
For
i
=
List1.ListCount
-
1
To
1
Step
-1
If
List1.List(i)
Like
"*BC*"
Then
List1.RemoveItem
i
Next
i
End
Sub
Private
Sub
Form_Load()
List1.AddItem
"A"
List1.AddItem
"B"
List1.AddItem
"C"
List1.AddItem
"D"
List1.AddItem
"AB"
List1.AddItem
"AC"
List1.AddItem
"AD"
List1.AddItem
"BC"
List1.AddItem
"BD"
List1.AddItem
"CD"
List1.AddItem
"ABC"
List1.AddItem
"ABD"
List1.AddItem
"ACD"
List1.AddItem
"BCD"
List1.AddItem
"ABCD"
End
Sub