3
I have a DataTable
where with the code:
DT.Column.Add("1ª", gettype(int32))
For I = 1 To 30
DT.Rows.Add(I)
Next(I)
This For
lists column 1 from 1 to 30. 'DT is declared with a new DataTable
, in this case the Prog does everything right, but I would like to know if it is possible for me to add a second column without being through:
DT.Column.Add("1ª", gettype(int32))
For I = 1 To 30
DT.Rows.Add(I, I*2)
Next(I)
This would be necessary as the formula in the second column varies according to the value of I
on each line. Examples and/or help in C# are welcome.
Working with lines I dominate relatively well, but spine 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.
I don’t understand the point. It’s creating a second column or putting data in it?
– Jéf Bueno
@jbueno precise popular the second column based on the data of the first. Popular numerous columns at a time (code 2) is quiet, but what I really need is to write code that allows the second column to be popular with limitations on the first. Example: When there is a
I>10
he will do in the second columnI/2
. It became clearer the objective?– Alex Nunes
Wait, I’m processing hehe
– Jéf Bueno
@jbueno You have time, if you want you can look at Filipe’s answer suddenly try to help me even more.
– Alex Nunes