如何把listview1的数据在listview2中纵向显示
listview1
a b c
a1 b1 c1
a2 b2 c2 listview2
a a1 a2
b b1 b2
c c1 c2 就是上面的例子,如何把listview1的数据在listview2中纵向显示 我知道用数组,请教代码怎么写Dim c()
Dim n As Integer, m As Integer
n = ListView1.ColumnHeaders.Count
m = ListView1.ListItems.Count
ReDim c(1 To m, 1 To n)
For i = 1 To m
For j = 1 To n
If i = 1 Then
c(i, j) = ListView1.ListItems.Item(i).Text
Else
c(i, j) = ListView1.ListItems.Item(i).SubItems(j)
End If
Next j
Next iFor j = 1 To m
For i = 1 To n
If i = 1 Then
ListView2.ListItems.Add.Text = c(j, i)
Else
ListView2.ListItems.Add.SubItems(i) = c(j, i)
End If
Next i
Next j
listview1
a b c
a1 b1 c1
a2 b2 c2 listview2
a a1 a2
b b1 b2
c c1 c2 就是上面的例子,如何把listview1的数据在listview2中纵向显示 我知道用数组,请教代码怎么写Dim c()
Dim n As Integer, m As Integer
n = ListView1.ColumnHeaders.Count
m = ListView1.ListItems.Count
ReDim c(1 To m, 1 To n)
For i = 1 To m
For j = 1 To n
If i = 1 Then
c(i, j) = ListView1.ListItems.Item(i).Text
Else
c(i, j) = ListView1.ListItems.Item(i).SubItems(j)
End If
Next j
Next iFor j = 1 To m
For i = 1 To n
If i = 1 Then
ListView2.ListItems.Add.Text = c(j, i)
Else
ListView2.ListItems.Add.SubItems(i) = c(j, i)
End If
Next i
Next j
Dim c()
Dim n As Integer, m As Integer
n = ListView1.ColumnHeaders.Count
m = ListView1.ListItems.Count
For i = 1 To m
For j = 1 To n
If j = 1 Then
ListView2.ListItems.Add.Text = ListView1.ListItems.Item(i).Text
Else
ListView2.ListItems(j).Add.SubItems(i) = ListView1.ListItems.Item(i).SubItems(j)
End If
Next j
Next i