Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multidimensional Array

Status
Not open for further replies.
Joined
Nov 14, 2000
Messages
31
Location
AU
I thought I 'got' multidimenstional arrays until I tried to use it.

I want to:

myArray(0) to be "c:\test"
myArray(0,0) = "file1.xxx"
myArray(0,1) = "file2.xxx"
myArray(0,2) = "file3.xxx"

myArray(1) to be "c:\test2"
myArray(1,0) = "file1.xxx"
myArray(1,1) = "file2.xxx"
myArray(1,2) = "file3.xxx"

etc...

I can set the value for example of myArray(0,0) etc but I can't get at the myArray(0) value?

Hope someone understands what I'm on about.

Thanks

Chuckster1

 
Multi-dimensional means more than 1 dimension, not that you can address elements with any number of dimensions up to the maximum. From your example, you seem to need multiple parallel arrays, a 1-dimensional for directory names corresponding to the file names in a 2-dumensional array.
Dim myDir() as string
Dim myArray() as String
Redim myDir(1)
Redim myArray(2)
myDir(0) to be "c:\test"
myArray(0,0) = "file1.xxx"
myArray(0,1) = "file2.xxx"
myArray(0,2) = "file3.xxx"

myDir(1) to be "c:\test2"
myArray(1,0) = "file1.xxx"
myArray(1,1) = "file2.xxx"
myArray(1,2) = "file3.xxx"

Dim I As Integer
Dim J As Integer
For I = 0 to Ubound(myDir)
For J = 0 to Ubound(myArray)
debug.print myDir(I) & "\" & myarray(I, J)
Next
Next
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Thanks for clearing that up M8.


Regards

Chuckster1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top