Results 1 to 7 of 7

Thread: [RESOLVED] simple copying of information from 1D array of arrays to 2D array

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Resolved [RESOLVED] simple copying of information from 1D array of arrays to 2D array

    Hi everyone, is there any reason that in this case intermediateArray will contain nothing when I've checked that tempArray does contain information. Both are declared as strings, and both are the same length.. The code is inside two loops to go through counter and counter2.

    VB Code:
    1. intermediateArray(counter, counter2) = tempArray(counter)(counter2)
    www.andyjessop.co.uk

  2. #2
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: simple copying of information from 1D array of arrays to 2D array

    then only reason to contain nothing is that temparray(counter)(counter2) is nothing
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Re: simple copying of information from 1D array of arrays to 2D array

    that's exactly what I thought. I've just checked it again and still every entry reads as nothing. I deliberately put an error right after it so that when debugging I could look back and find out the contents of each array and compare them. the full loop code is:

    VB Code:
    1. Dim intermediateArray(0 To 5, 0 To 5) As String
    2.             ReDim intermediateArray((y - 1), x)
    3.  
    4.             For counter = 0 To (y - 1)
    5.                 For counter2 = 0 To (x)
    6.                     intermediateArray(counter, counter2) = tempArray(counter)(counter2)
    7.                 Next
    8.             Next

    Testing the values right after this loop gives the values of tempArray as they are supposed to be (not nothing) and the values of intermediateArray as nothing for each entry.

    tempArray contains { {1,2,3,4,""}, {1,2,3,4,""} etc. }
    intermediatearray contains {nothing,nothing, etc.}

    Can you suggest anyway that I can attempt to debug it. What kind of thing I should be looking for in the code etc.

    Thanks
    Andy
    www.andyjessop.co.uk

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Re: simple copying of information from 1D array of arrays to 2D array

    Problem solved, I'm being an idiot!
    www.andyjessop.co.uk

  5. #5
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: [RESOLVED] simple copying of information from 1D array of arrays to 2D array

    To many time looking for witches and elfs in your program
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  6. #6
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: [RESOLVED] simple copying of information from 1D array of arrays to 2D array

    was it..

    intermediateArray(counter, counter2) = tempArray(counter, counter2)

  7. #7

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Re: [RESOLVED] simple copying of information from 1D array of arrays to 2D array

    not quite, pasvorto - it was the debugging info that I was misreading...
    www.andyjessop.co.uk

Posting Permissions

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



Click Here to Expand Forum to Full Width