VB中Collection存放的数组如何还原
尝试使用Collection存放数组,可以存进去,但是怎么拿出来,还原为数组?
以下的代码在取出的部分报错:
Visual Basic code?Dim list as Collection '存放 Dim arr(0 to 2) as Stringlist.add arr ... '取出 Dim aa(0 to 2) as Stringfor i=1 to list.Count set aa = list.item(i)‘报错 debug.print aa(0) next i
'存放 Dim arr(0 To 2) As StringFor i = 0 To 2 list.Add arr(i) Next '取出 Dim aa(0 To 2) As StringFor i = 1 To list.Count aa(i - 1) = list.Item(i) Debug.Print aa(i - 1) Next i
Dim thisCustomer As Object
While list.MoveNext()
thisCustomer = list.Current()
End While
然后再转为STRING
原来可以不用转换,可以直接用:
list.Item(i)(0)
list.Item(i)(1)
习惯用JAVA的思维了。