如何把listview1的数据转置在listview2中显示
listview1
a b c
a1 b1 c1
a2 b2 c2 listview2
a a1 a2
b b1 b2
c c1 c2 我自己的代码,发觉用数组都不知道怎么解决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 j = 1 Then
c(i, j) = ListView1.ListItems.Item(i).Text
Else
c(i, j) = ListView1.ListItems.Item(i).SubItems(j - 1)
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 - 1) = c(j, i)
End If
Next i
Next j请高手指教指教,还有一点就是listview中的列是动态变化的,不是定列的
listview1
a b c
a1 b1 c1
a2 b2 c2 listview2
a a1 a2
b b1 b2
c c1 c2 我自己的代码,发觉用数组都不知道怎么解决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 j = 1 Then
c(i, j) = ListView1.ListItems.Item(i).Text
Else
c(i, j) = ListView1.ListItems.Item(i).SubItems(j - 1)
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 - 1) = c(j, i)
End If
Next i
Next j请高手指教指教,还有一点就是listview中的列是动态变化的,不是定列的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货