2010年3月24日 星期三

Move Column position in Data Table

Q: How to Insert Data Column in a specified position, instead of appending to last column?
A: DataTable.Columns.Add does not support it. We need to adjust the position after adding the column. The sample code is listed as below:

 
  Dim mColumn As New DataColumn("Column1")
  Table1.Columns.Add(mColumn)
  mColumn.SetOrdinal(0)