I walk through the Listbox as this way and It works:
For i as integer=0 to listbox.listcount -1 'Cuenta las listas
For j as integer=0 to listbox.ColumnCount -1 'Cuenta las columnas
redim my2Darray(i, j)
Msgbox listbox.Cell(i, j)
my2dArray(i,-1) = listbox.Cell(i,j)
Next
Next
I’m using Redim “my2Darray” to redimension my array to according of cells existing on the Listbox.
But how can I pass it to my Array Dim my2Darray(-1,-1) As String.
By redimming your array each time thru the loop, you’re destroying what was previously there.
dim rowCt As Integer = listbox1.Listcount-1
dim colCt As Integer = listbox1.ColumnCount-1
redim my2Darray(rowCt, colCt
For i as integer=0 to rowCt
For j As integer = 0 to colCt
my2dArray(i, j) = listbox1.cell(i, j)
Next
Next
But when I put redim inside the loop, When I try to getting value of the array I get no value.
So, when I redim the array outside the loop, It works. I can get any value of the array.