# 还要加上 Collectionm物件

Posted by cww on October 16, 1998 at 08:30:57:

In Reply to: 小吴高手,还是不行.... posted by 小EZ on October 15, 1998 at 12:36:56:

您的需求不是ListBox本身可解决，要再加上Collection
物件的配合，比较有办法完成，的程式更改新增如下

Private coll as new Collection

Private Sub Command2_Click()
Dim str5 As Variant

'For i = 0 To List1.ListCount - 1
'If List1.Selected(i) Then
'List3.AddItem List1.List(i) & "*" & List2
'End If
'Next i
For Each str5 In coll
List3.AddItem str5 & "*" & List2
Next
End Sub

Private Sub List1_Click()
With List1
If .Selected(.ListIndex) Then
coll.Add .Text, CStr(.ListIndex)
Else
coll.Remove CStr(.ListIndex)
End If
End With
End Sub

Follow Ups: