[Solved] How to sort listbox with letters and numbers ascendent by numbers vb.net


It looks like you are actually looking for descending order. Anyways, here is a solution from one list to another:

Dim myList As List(Of String) = {"test|10", "name|44", "blabla|16"}.ToList
Dim orderedList As List(Of String) = (From item In myList Order By item.Substring(item.IndexOf("|") + 1) Descending Select item).ToList

EDIT: This will sort the items as strings, which means that if you have 44, 16, 100, and 10, it would look like this after being sorted: 44, 16, 100, 10. This is probably not what you want, so you should parse the numbers out into integers so that they sort numerically. Try this:

Dim myList As List(Of String) = {"test|10", "name|44", "blabla|16", "foo|100"}.ToList
Dim orderedList As List(Of String) = (From item In myList Order By Integer.Parse(item.Substring(item.IndexOf("|") + 1)) Descending Select item).ToList

6

solved How to sort listbox with letters and numbers ascendent by numbers vb.net