# Re: 小琳.....help me......thanks！

Posted by 小琳 on October 10, 1999 at 17:34:54:

In Reply to: 小琳.....help me......thanks！ posted by sos gril on October 09, 1999 at 01:08:48:

: 如何将listview1中的所有内容全部加入到listview2中呢(不是一项一项的点选加入喔!)?又如何将listview中的内容一次全部移除掉呢?
: 可否直接写段范例程式以供参考，因为本人实在是不太会写程式，须有例子做辅助．．．．Thanks！

:::"饭粒"如下：（二个Listview及二个按钮）
Option Explicit

Private Sub Command1_Click()
Dim i As Integer, j As Integer
j = ListView1.ListItems.Count
For i = 1 To j
With ListView2
.ListItems.Add , , ListView1.ListItems(i).Text
.ListItems(i).ListSubItems.Add , , ListView1.ListItems(i).ListSubItems(1).Text
End With
Next i
End Sub

Private Sub Form_Activate()
With ListView1
.ColumnHeaders.Add , , "姓名"
.ColumnHeaders.Add , , "内容"
.ListItems.Add , , "aaa"
.ListItems.Add , , "bbb"
.ListItems.Add , , "ccc"
.ListItems(1).ListSubItems.Add , , "a1"
.ListItems(2).ListSubItems.Add , , "b1"
.ListItems(3).ListSubItems.Add , , "c1"
End With
With ListView2
.ColumnHeaders.Add , , "姓名"
.ColumnHeaders.Add , , "内容"
End With
End Sub

Private Sub Command2_Click()
ListView2.ListItems.Clear
End Sub

Follow Ups: