Follow this approach:
- Iterate through
dt1Columns usingFor Eachactivity. assign a index variable to it.
- Add one
Assignactivity insideFor Eachlike this
dt2.Columns(intColumnIndex).ColumnName = currentItem.ColumnName
That’s it. It will change the column names of the dt2 same as dt1
