Arrays please help me

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aka

    #1

    Arrays please help me


    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
  • Mike Lowery

    #2
    Re: Arrays please help me


    "aka" <aka@discussion s.microsoft.com wrote in message
    news:6C15C5EB-4EB2-4BE5-84E1-3E4E7CE52462@mi crosoft.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


    Comment

    • RJ

      #3
      RE: Arrays please help me

      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.AddRang e(OldList.GetRa nge(6, 4))


      "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

      Comment

      Working...