Automatically make .trim () on a datatable in all rows and columns

have a look here:

in your case:
(From r In dtData.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e) e.ToString.Trim()).toArray()
Select dtCorrected.Rows.Add(ic)).CopyToDataTable()

or

(From r In dtData.AsEnumerable
Select rac = r.ItemArray.Select(Function (x) x.toString.Trim).toArray
Select dtCorrected.Rows.Add(rac)).CopyToDataTable()

4 Likes