Solved

How do access data in a 2-dimensional array?

Posted on 2013-12-11
2
195 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 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now