• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Multi-Dimensional Array

Ok, I'm trying to get this format into an array

        A         B          C         D
1    Jim
2
3
4
5
6          Christina
7                         Paul
8
9
10

Where I can select items to put into my array like a class seating chart. A1 = Jim, C7 = Paul, B6 = Christina.
I've been trying diffrent thing and can't get anything to work. I'm trying to turn it into a multi-dimensional array.
0
Blackmere
Asked:
Blackmere
1 Solution
 
mlmccCommented:
First with VB arrays all indexes are numeric.

Dim MyScores(5) as integer

Creates an array of 6 elements (0-5) of integers.

MyScores(0) = 100

Similarly for multidimensioned arrays

Dim Names(10,6) as string

Names(0,0) = "Jim"

mlmcc
0
 
DocMCommented:
If you are working with an Excel sheet,
you can do this:

ReDim myArray(9, 2)
 For r = 1 To 10 'Read rows 1 to 10
   For c = 1 To 3 'Read Columns A to C
    myArray(r - 1, c - 1) = Cells(r, c).Value
   Next
 Next
0
 
JacamarCommented:
Well, first off, that is going to be a 2 dimensional array, which can be declared by

Private Enum Names

A = 0
B = 1
C = 2
'ect

End Enum

Private fName As Names

Private Sub Form_Load()

Dim array1() As String
inI = 3
ReDim array1(1 To inI, A To C) As String



Open App.Path + "\Text.txt" For Input As #1

For inJ = 1 To inI

 For inL = A To C
    Input #1, array1(inJ, inL)
    Picture1.Print array1(inJ, inL)
 Next inL

Next inJ

I hope this is what you are looking for.

Jacamar
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now