Arrays please help me

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all
I have two arrays .
array1 contains 10 elements
array2 contains 6 elements
I need to assign the left over 4 elements of array1 into new array .
Can anyone give me a peice of code ,how to achieve this?
ITs really urgent please help me
thanks in adv
 
aka said:
Hi all
I have two arrays .
array1 contains 10 elements
array2 contains 6 elements
I need to assign the left over 4 elements of array1 into new array .
Can anyone give me a peice of code ,how to achieve this?
ITs really urgent please help me
thanks in adv

Assuming your arrays start at base zero:

Dim array3(4)
for i=0 to 3
array3(i) = array1(i + 6)
next i
 
Another way may be to use List instead of array...
Dim OldList As New List(Of String)
Dim NewList As New List(Of String)

' If OldList contains 10 elements, this will get the 6th thru 10th from
OldList
' and add them to NewList
NewList.AddRange(OldList.GetRange(6, 4))
 
Back
Top