Solved

How do access data in a 2-dimensional array?

Posted on 2013-12-11
2
198 Views
Last Modified: 2013-12-11
I have a 2-dimensional array that I built. For some reason, I can't remember how to extract the data from it using a For Loop. Here is what I have, which doesn't make sense to me because it appears that I'm doing the same thing twice.

    Dim strData As String = ""

    For x As Integer = 0 to arrLoadTest.Length - 1
        For y As Integer = 0 to arrLoadTest.Length - 1
            strData = arrLoadTest(x, y)
        Next
    Next
0
Comment
Question by:BlakeMcKenna
2 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39711862
That is correct. While the first loop x goes from o to the end of the first index the second loop y is going through the second index in like manner. So that it accesses the array as follows:

arrLoadTest(0,0),  arrLoadTest(0,1), ..., arrLoadTest(0,n)
arrLoadTest(1,0),  arrLoadTest(1,1), ..., arrLoadTest(1,n)
...
arrLoadTest(m,0),  arrLoadTest(m,1), ..., arrLoadTest(m,n)
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 39711919
Ok, after I thought it through it made sense. The array was based off of a DataGridView (the number of rows and columns) so I just stored those values into variables and used those variables as the indexes.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question