|
Tutorials
|
|
Written by Administrator
|
|
Show/Hidden vbnet code
Public Sub CopyArray(FromArray As Variant, ToArray As Variant)
'Copies source array to dest array
'ToArray should be dynamic array
Dim l As Long, lUBound As Long, lLBound As Long
If (Not IsArray(FromArray)) Or (Not IsArray(ToArray)) Then Exit Sub
lLBound = LBound(FromArray)
lUBound = UBound(FromArray)
ReDim ToArray(lLBound To lUBound)
For l = lLBound To lUBound
ToArray(l) = FromArray(l)
Next
End Sub
Sub TestCopyArry()
Dim i(2) As Integer, j() As Integer
Dim iCtr As Integer
i(0) = 5
i(1) = 8
i(2) = 10
CopyArray i, j
For iCtr = 0 To UBound(j)
Debug.Print j(iCtr)
Next
End Sub
Attachments:
| File | Description | File size | Downloads |
CopyArray.txt | Copy Array | 0.6 Kb | 229 |
|