I am in the process where I need to remove the columns which have the column name containing the word “Column”.
For example, I have dtNew with column names (“Name”, “Column Place”, “Animal”,“Column Thing”,“Planet”).
I am using the for each loop to scan through DtNew such that I can remove “Column Place” and “Column Thing” and keep the other columns in my dtNew.
What I tried:
for each col in “dtNew.Column”
message box: col.tostring.trim
(Note:- I was able to get the string value of all the column names)
But when I tried:
For each col in “dtNew.Column”
Remove Data Column:- (datatable: dtNew) (ColumnName: col.tostring.trim)
(Note:- I was getting an error:- “For Each: Collection was modified; enumeration operation may not execute.”,)
Note: error is popped up only if I use the remove data column activity.
Thanks and Regard,