如何把listview1的数据转置在listview2中显示
如何把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 i
For 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添加项目的时候同时向listview2里也添加呢? --------------------编程问答-------------------- 接分先! --------------------编程问答-------------------- 关注 接分
补充:VB , 基础类