如何使用Array
将Array
的数据传递给另一个VB6
?
答案 0 :(得分:6)
在VB6中,数组被复制到一个简单的赋值中。
Dim arr1() As Long
Dim arr2() As Long
ReDim arr1(1 To 10)
'Fill arr1 with data
arr2 = arr1
答案 1 :(得分:0)
试试这个:
Dim lArray1(3) As Long
Dim lArray2(3) As Long
Dim count As Long
lArray1(0) = 1
lArray1(1) = 2
lArray1(2) = 3
lArray2(0) = 10
lArray2(1) = 20
lArray2(2) = 30
For count = LBound(lArray1) To UBound(lArray1)
lArray2(count) = lArray1(count)
Next count
Erase lArray2
如果它不是固定长度,你需要在循环中使用redim。
答案 2 :(得分:0)
我已经回答了我的问题:)谢谢你们的帮助,但这就是我所做的。
'Delete items in Array first
For lngIndex = 0 To UBound(time2) - 1
time2(lngIndex) = time2(lngIndex + 1)
Next
'Next thing is
'Insert items in Array
For lngIndex = UBound(time1) - 1 To 0 Step -1
time1(lngIndex + 1) = time2(lngIndex)
Next
此代码解决了我的问题:)