How to put Items on Multidimensional Array?

Hi all!

Good day.

How can I put items on a multidimensional Array?
I only added values on a multidimensional array. and used SPLIT do put all items on a strings separated by a comma on a One Dimension string.

But I wanna add it in one column of my Array.

Normally I use as this, for write in the 5 columns of my array:

DataArray(i,0) = “Name”
DataArray(i,1) = “Adress”
DataArray(i,2) = “Phone Number”
DataArray(i,3) = “Provider Name”
DataArray(i,4) = “Company Name”
DataArray(i,5) = “CEO”

I used as this but i got an Mismatch error:

DataArray(i,5) = Links.split(",")
//Where Links is the String with many values divided by a comma

Thanks

Split can only create a single dimension array. I would create a class to hold the data then create an array of that class. Others may create an array of type dictionary. I prefer the class as it is strongly typed and autocompletes, but the dictionary is more flexible.

dim links as string = "value0, value1, value2, value3, value4, value5"
dim arr() as string = links.split(",")
for j as integer = 0 to 5
    DataArray(i, j) = arr(j)
next j

Not sure what you mean by (i, 5), I’d think you want to just specify which row to put the array in. This can be made as an extension method…

Sub setRow(extends arr(,) As String, rowIndex As integer, assigns newRowData() As String) if rowIndex < 0 or rowIndex > UBound(arr, 1) then return dim last As integer = Min(Ubound(arr, 2), newRowData.Ubound) for i As integer = 0 to last arr(rowIndex, i) = newRowData(i) next End Sub
call like this

DataArray.setRow(i) = Links.split(",")