SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    writing data from two arrays

    Hello,

    I have a question about array

    I have tow arrays

    myarray1 (5)
    1
    2
    3
    4
    5


    myarray2(5)

    orange
    carrot
    apple
    banana
    grape


    I want to concatenate the two arrays like 1 orange, 2 carrot , 3 apple ..... etc

    How can I do this ?
    I tried to create a two dimensional array and add each array to it but did not work .


    Any suggestion is greatly appreciated.

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    689
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dim MyArray3(5)

    for i = 1 to 5
    MyArray3(i) = MyArray1(i) & " " & MyArray2(i)
    next

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your response but I am getting ....Subscript out of range: '3'
    do you have any idea

    my code is
    dim MyArray3

    ReDim MyArray3(UBound(mycommentarray))

    for i = 0 to UBound(mycommentarray)
    MyArray3(i) = mycommentarray(i) & " " & myidarray(i)
    next

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind I got it .
    Thank you so much ...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •