Question : Would like to add column to existing Datatable, then add items to it one at a time.

I'm quite sure this isn't the correct way to do this, but I'm also equally sure I have little to no idea what I'm talking about.
Either way, here goes.

I have an existing Datatable which contains data similar to:

COL1        COL2        COL3
Name1     Num1       Num2
Name2     Num1       Num2
Name3     Num1       Num2

I would like to add another column, and then add values to that column.
For example, after one pass in a for/next loop, the datatable would be:

COL1        COL2        COL3        COL4
Name1     Num1       Num2       Num3
Name2     Num1       Num2
Name3     Num1       Num2

After the second pass in the loop, the datatable would be:

COL1        COL2        COL3        COL4
Name1     Num1       Num2       Num3
Name2     Num1       Num2       Num3
Name3     Num1       Num2

I hope that makes sense.
Can I add a column to a datatable and then add items one at a time?

Here's what I have (which doesn't work of course):

myDataTable.Columns.Add(myColumn)

... and then later, in a for/next loop I have:

Row = myDataTable.Rows(RowNum)
Row.Item("myColumn") = NumX

Thanks for help with my question!

Answer : Would like to add column to existing Datatable, then add items to it one at a time.

Instead of this
myDataTable.Columns.Add(myColumn)
you need to have something that looks like this:

Dim myColumn  as dataColumn
TableStats.Columns.Add("Total",Type.GetType("System.Double"))
Random Solutions  
 
programming4us programming4us