[quote=208832:@Gerardo García]So, then if I want to add values. Is this the right way to do it?:
for example for the headers:
my2Darray(0,0) = “unit”
my2Darray(0,1) = “quantity”
my2Darray(0,2) = “Description”
my2Darray(0,3) = “Price”
Pls tell me if I’m wrong. :)[/quote]
Hi once in a time I made a For to process a Listbox in order to pass Columns and Rows to a Multidimensional Array:
[b] ReDim my2DArray(-1,-1) 'Por si la Matriz ya contiene datos
ReDim my2DArray(Listbox.ListCount - 1, Listbox.ColumnCount - 1) 'La redimensiona segun las columnas y filas que tenga el listbox
For i as integer=0 to listbox.listcount -1 'Cuenta las listas
For j as integer=0 to lista.ColumnCount -1 'Cuenta las columnas
my2dArray(i,j) = listbox.Cell(i,j)
'Msgbox "Matriz: " + my2dArray(i,j)
Next
Next[/b]
It works Flawlessly.
But now I have a different idea jumping on my mind.
I have a multidimensional Array, I want to have Four columns and Rows as many as I want.
MatrizCFDI(-1,-1) As String
Then to redimension to the requested number of rows and columns I do this: ReDim MatrizCFDI(-1, 3)
Pls. Correct me If I’m wrong.
Then In the last code I done this: my2dArray(i,j)= listbox.Cell(i,j)
But this was a Listbox. What If I have two variables to load?
Will It be valid to use my2dArray(i,j)= “Cats”, “Dogs”??
And How will I do the For instruction talking about If I need to add four columns?
Thanks