visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Visual Basic :: Copying Arrays


By: Rj U.S.A.  Date: 03/10/2003 00:00:00  English  Points: 300 Status: Answered
Quality : Excellent
I have a byte array. How do I copy it to another array of same type. I need the program in visual basic 6.0
By: Rj Date: 03/10/2003 21:58:00 English  Type : Comment
Quite urgent.
By: VGR Date: 03/10/2003 22:19:00 English  Type : Assist
you do a for(i) loop and copy firstarray to newarray...
By: Rj Date: 03/10/2003 22:26:00 English  Type : Comment
Ummm..,....I am sorry for not mentioning before. Its too slow when I try that. I need a quick way. This byte array is quite big.
By: Arthur_Wood Date: 03/10/2003 22:40:00 English  Type : Answer
there is no other way. You MUST copy each entry form one array to the other. If you try to simply set NewArray = OldArray, New Array will hold a REFERENCE to the OldArray.

AW
By: stoliD Date: 03/10/2003 23:15:00 English  Type : Assist
thats right. All you could do is set two different variables to the same pointer to your byte-array. Else you would need to copy every single element. Perhaps you could explain what u need this copy for, and if you need a complete copy.... maybe you could share the code... and well find another solution.
By: Rj Date: 04/10/2003 00:12:00 English  Type : Comment
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

This was one suggestion given in another forum. Itried using this but it gives a memory error.
By: johnQuestion Date: 05/10/2003 01:42:00 English  Type : Comment
You might want to try this, if your array is 20 elements long, then run a loop to transfer the data:
Dim Array1(1 to 20) As Single 'array with data
Dim Array2(1 to 20) As Single 'array w/o data
Dim i As integer

For i = 1 to 20
Array2(i) =Array1(i)
Next i

By: GHehmann Date: 09/10/2003 04:09:00 English  Type : Comment

the declaration from the sub is wrong

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

By: johnQuestion Date: 09/10/2003 06:43:00 English  Type : Comment
single would be used for numbers, string for letters and words, what are you using? There are also double, integer that are commonly used

Do register to be able to answer

EContact
browser fav
page generated in 311.940910 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page