How to print an array with variable dimensions in VB
How to print an array with variable dimensions in VB
(OP)
Does anyone know how to print an array with variable dimensions in VB?
The following code won't do what I want, it outputs only one column, not rj (10 here) columns.
Open "debug.txt" For Output As #1
rm=10
rj=10
For i = 1 To rm
For j = 1 To rj
Print #1, my_array(i,j)
Next j
Next i
Close #1
What is the right code for my purpose? Thanks for your help.
Jack
The following code won't do what I want, it outputs only one column, not rj (10 here) columns.
Open "debug.txt" For Output As #1
rm=10
rj=10
For i = 1 To rm
For j = 1 To rj
Print #1, my_array(i,j)
Next j
Next i
Close #1
What is the right code for my purpose? Thanks for your help.
Jack
RE: How to print an array with variable dimensions in VB
dim fileNum as integer
'get the free file number
fileNum= Freefile
Open "debug.txt" For Output As fileNum
'allow for whatever the array has been dimensioned to
rm = ubound(my_array,1)
rj = ubound(my_array,2)
For i = 1 To rm
For j = 1 To rj
print fileNum, my_array(i,j), 'note the trailing commas
Next j
'new line
print fileNum, vbCrLf
Next i
Close #1