Hi,
Is there any way to copy an array to another array of the same size as long as they are both defined the same. Oh, I would not like to use loops or using a variant type array for the second one recieving the data. Any way to do this? thanks
Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
If your destination array is a dynamic array, then you can simply copy the source array to destination using a simple assingment. Otherwise, you can use the CopyMemory function to copy an array to a fixed array.
___
[tt]
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
Dim A(5) As Long, N As Long
Dim B() As Long 'dynamic array
Dim C(5) As Long 'fixed array
'fill the source array
For N = 0 To 5
A(N) = N
Next
'copy A to B
B = A
'copy A to C
CopyMemory C(0), A(0), 24 'size of the array
End Sub[/tt]
___
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.