Solved

How do access data in a 2-dimensional array?

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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