how to copy or move array to another array

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2009
Posts: 7
Reputation: zahraj is an unknown quantity at this point 
Solved Threads: 0
zahraj zahraj is offline Offline
Newbie Poster

how to copy or move array to another array

 
0
  #1
Apr 2nd, 2009
hi

how to copy or move array to another array

for example:
 Dim arr1 As New ArrayList
 Dim arr2 As New ArrayList

and arr1 has values ...I want to copy or move all values to arr2
with out use for loop to copy each value

help me!!!
ZoZo
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: how to copy or move array to another array

 
0
  #2
Apr 2nd, 2009
You mean like:
  1. arr2 = arr1
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 7
Reputation: zahraj is an unknown quantity at this point 
Solved Threads: 0
zahraj zahraj is offline Offline
Newbie Poster

Re: how to copy or move array to another array

 
0
  #3
Apr 3rd, 2009
hi

yes i mean arr2 should hold values that arr1 have

like this:

dim arr1 as new arraylist
dim arr2 as new arraylist

For i = 0 To arr1.count-1
arr2.add(arr1.item(i).
Next
but i want code for vb done the copy

like
arr1.copy to arr2 How i can do this ??????????
Last edited by zahraj; Apr 3rd, 2009 at 5:08 am.
ZoZo
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 51
Reputation: martonx is an unknown quantity at this point 
Solved Threads: 8
martonx martonx is offline Offline
Junior Poster in Training

Re: how to copy or move array to another array

 
0
  #4
Apr 3rd, 2009
Dim sourceArray As Array
Dim destinationArray As Array
Dim length As Integer

Array.Copy(sourceArray, destinationArray, _
length)
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 7
Reputation: zahraj is an unknown quantity at this point 
Solved Threads: 0
zahraj zahraj is offline Offline
Newbie Poster

Re: how to copy or move array to another array

 
0
  #5
Apr 4th, 2009
thanks martonx you help me in my project
ZoZo
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 89
Reputation: toko is an unknown quantity at this point 
Solved Threads: 8
toko's Avatar
toko toko is offline Offline
Junior Poster in Training

Re: how to copy or move array to another array

 
0
  #6
Apr 6th, 2009
Why don't yo just do:
  1. Dim arrayNumOne(20) as integer
  2. Dim arrayNumTwo(20) as integer
  3. Dim Counter as integer
  4. for counter = 0 to 20
  5. arrayNumOne(counter) = arrayNumTwo(counter)
  6. next
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC