Re-order Multiple Column in Datatable

Hi All,

Currently i have this datatable :


Column A Column B Column C 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.25 0.75 0.95

And i want to reorder all numeric column ASC, become :


Column A Column B Column C 0.1 0.2 0.25 0.3 0.4 0.5 0.6 0.7 0.75 0.8 0.9 0.95 1

Thankyou

Hi,

Are these header of the datatable? if so, how about the following?

dt.DefaultView.ToTable(False,dt.Columns.Cast(Of DataColumn).Select(Function(dc) dc.ColumnName).OrderBy(Function(s) if(Double.TryParse(s,New Double),Double.Parse(s),Double.MinValue)).ToArray)

Sample20230906-1L.zip (13.1 KB)

Regards,

HI @Yoichi - San,

Yes, these are header of datatable.
And Already test your code and it works perfectly.

Thankyou

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.