Hello,
I have an array numbers that contanis some data that need to display on datagrid so I'm buildind a datatable. It also contains the headers, and the numbers of rows and columns.
Of course this parameters can change so as the columns and rows.
The goal is sommething like this:
|100 | 200 | 300 | 400 | 500 |
-----------------------------------
20 | 0 | 18 | 23 | 65 | 41 |
30 | 22 | 91 | 64 | 33 | 18 |
40 | 44 | 63 | 91 | 26 | 32 |
50 | 61 | 83 | 91 | 26 | 32 |

where the bolded numbers are the headers.
in the code I'm exctacting the headers, creating the columns at runtime, but I'm stuck in how create and fill the rows.
Any advice?
Code:
Private Function getdata() As DataTable
        Dim numbers = New Integer() {61, 61, 61, 61, 61, 20, 30, 40, 50, 100, 200, 300, 400, 500, 0, 0, 0, 0, 0, 18, 23, 65, 41, 22, 91, 64, 33, 18, 44, 63, 91, 26, 32, 61, 83, 91, 26, 32, 91, 91, 91, 91}
        Dim nC As Integer = 5
        Dim nR As Integer = 4
        Dim K As Double = 0.5
        Dim StartbpC As Integer = 18
        Dim StartbpR As Integer = 5
        Dim bpc As New List(Of Integer)
        For I = 0 To nC - 1
            bpc.Add(numbers(StartbpC + I))
        Next
        For I = 0 To nR - 1
            bpc.Add(numbers(StartbpR + I))
        Next

        Dim dt As New DataTable("map")
        Dim column As DataColumn
        Dim row As DataRow
        column = New DataColumn
        column.DataType = System.Type.GetType("System.Int32")

        For I = 0 To bpc.Count - 1
            column = New DataColumn
            column.DataType = System.Type.GetType("System.Int32")
            column.ColumnName = bpc(I).ToString
            column.Caption = bpc(I).ToString

            dt.Columns.Add(column)
        Next
        Dim dataSet As New DataSet()


        dataSet.Tables.Add(dt)


        For I = 0 To nR - +1
            Dim myrow = dt.NewRow()
'I'm stuck here
            dt.Rows.Add()

        Next

        Return dt
    End Function