VBGamer |
|
I think... Rag on a Stick (0 replies, 0 views) (2000-Jun-24) I think what he is getting at is something like this:
You have 2 arrays, Array1 and Array2. You want to copy Array1's contents to Array2 so you type something like this (different depending on subscripts/dimensions)
For i = 0 To 100
Array2(i) = Array1(i)
Next
This takes a lot of processor time as it has to do 100 additions (i = i + 1) and check to see if I is greater than 100 and also change Array2's value.
A more efficient way is something like this
From = VarPtr(Array1(0)) 'VarPtr returns the pointer
To = VarPtr(Array2(0))
Length = SizeOfArray 'Something like 4 bytes plus 101 * size of data type
CopyMemory From, To, Length
Note, CopyMemory must first be declared.
I've never used this method and someone may want to correct me or give the exact formula for working out the length. But that is the general formula for success.
hth |