How to sort datatable by specific column value in custom order?

How to sort datatable by specific column value in custom order ???
for example , i have 3 columns shrtname , val1, val2 , but the shrt name 8-15, 3-8, 30 above , 1-3 , need to sort the datatable by shrtname by this custom order – 1-3, 3-8,8-15,16-30 and 30 above

Hi,

The following topic / sample may help you

Regards,

Hi @saninfo273

Assign-> customOrder = {"1-3", "3-8", "8-15", "16-30", "30 above"}

Assign-> dtSorted = dtOriginal.AsEnumerable().OrderBy(Function(row) Array.IndexOf(customOrder, row.Field(Of String)("shrtname"))).CopyToDataTable()

customOrder is of DataType Array(System.String)
dtSorted is of DataType System.Data.DataTable.

Hope it helps!!