Home All Groups Group Topic Archive Search About

Arrays please help me

Author
24 Aug 2006 2:03 PM
aka
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

Author
24 Aug 2006 2:38 PM
Mike Lowery
"aka" <a**@discussions.microsoft.com> wrote in message
news:6C15C5EB-4EB2-4BE5-84E1-3E4E7CE52462@microsoft.com...
>
> 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
Author
25 Aug 2006 3:05 AM
RJ
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))


Show quoteHide quote
"aka" wrote:

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