I have DataTable
where with the code:
DT.Column.Add("1ª", gettype(int32))
For I = 1 To 30
DT.Rows.Add(I)
Next(I)
This For
enumerates column 1 from 1 to 30. 'DT is declared with a new DataTable
, in this case the prog makes everything correct, but I would like to know if it is possible to add a second column without being by means of:
DT.Column.Add("1ª", gettype(int32))
For I = 1 To 30
DT.Rows.Add(I, I*2)
Next(I)
This would be necessary because the formula in the second column varies according to the value of I
in each row. Examples and / or help in C # are welcome.
Working with line I master relatively well, but column is always a headache for me.
I tried something like:
For I = 1 To 30
DT.Rows.Add(I)
Next(I)
DT.Column.Add("2ª", gettype(int32))
For I = 1 to 30
DT.Rows.Add(I)
Next(I)
But without any success, it just creates column 2 and adds data to column 1.