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!!!

Recommended Answers

All 5 Replies

You mean like:

arr2 = arr1

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 ??????????

Dim sourceArray As Array
Dim destinationArray As Array
Dim length As Integer

Array.Copy(sourceArray, destinationArray, _
length)

thanks martonx you help me in my project :)

Why don't yo just do:

Dim arrayNumOne(20) as integer
Dim arrayNumTwo(20) as integer
Dim Counter as integer
for counter = 0 to 20
arrayNumOne(counter) = arrayNumTwo(counter)
next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.