EspertoDiProgrammazione EspertoDiProgrammazione - 1 year ago 83 Question

How to sort a team data in alphabet order

I've a table like this:

Dim Classifica_Table() As Team_Data

I want to order the table in alphabet mode, in particular, this table contains all team of a championship grabbed by webpage.

This value are inserted in a Combobox:

For Each Team As Team_Data In Classifica_Table
ComboBox1.Items.Add(Team.Name) 'Populate Combo Boxes with team names

but the order isn't good for me, so I want sort in alphabet.
How can I do this? I tried with
but seems doesn't working, the compiler tells me: that nothing Sort() accept this argument number.

Answer Source

You could use the IEnumerable extension OrderBy

For Each Team As Team_Data In Classifica_Table.OrderBy(Function(x) x.Name)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download