I have this XML file from which I’m grabbing all the data:
<?xml version="1.0" encoding="utf-8"?>
<Tabel>
<Member>
<Naam>Cruciatum</Naam>
<Kills>10</Kills>
<Deaths>2</Deaths>
<Score>2222</Score>
</Member>
<Member>
<Naam>test</Naam>
<Kills>123</Kills>
<Deaths>12</Deaths>
<Score>12222</Score>
</Member>
<Member>
<Naam>test2</Naam>
<Kills>159</Kills>
<Deaths>12</Deaths>
<Score>2222</Score>
</Member>
<Member>
<Naam>test3</Naam>
<Kills>159</Kills>
<Deaths>122</Deaths>
<Score>222284</Score>
</Member>
<Member>
<Naam>test4</Naam>
<Kills>15</Kills>
<Deaths>1229</Deaths>
<Score>129453</Score>
</Member>
</Tabel>
I got it all to show in 5 different listboxes (1 for each childnode under “Member”).
I have this following code to do that.
Public Class Rank
Dim memberNodes As XmlNodeList
Dim memberNode As XmlNode
Dim x As Short
Dim dataNodes As XmlNodeList
Dim firstinrow As Boolean
Dim datalist(5) As String
Dim y As Short
Private Sub Rank_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
lstView.Items.Clear()
x = 0
Dim doc As New XmlDocument()
doc.Load("C:\Members.xml")
memberNodes = doc.GetElementsByTagName("Member")
For Each memberNode In memberNodes
dataNodes = memberNode.ChildNodes
y = 1
For Each dataNode As XmlNode In dataNodes
datalist(y) = dataNode.InnerText
datalist(0) = (x + 1).ToString
y += 1
Next
datalist(5) = datalist(4)
datalist(4) = FormatNumber((datalist(2) / datalist(3)), 3)
Dim lvi As New ListViewItem(datalist)
lstView.Items.Add(lvi)
x += 1
Next
End Sub
End Class
That code is working fine for now, displaying the full list.
But now I need all the data sorted by the values in the Score column of the listview, so for in the following example:

I would need the first line to say: “1 test3 159 122 1.303 222284”
Second line the 2nd place on Score, etc.
Update:
Instead of seperate listboxes I’m now using 1 listview, as recommended by @SteveDog
Instead of separate list boxes, use a ListView control with the View property set to Details, or use a DataGridView control. If you must use separate list boxes like that, you will need to implement the IComparable interface on each class to override the sorting.
Sorting in a ListView control is admittedly a bit of a pain. It’s nice to have it be so flexible, but it’s a pain when all you want to do is a simple sort. First, you need to create a sorter object that implements the IComparer interface. For instance:
Then you need to set the ListView control’s ListViewItemSorter property to a new instance of the sorter object, then tell it to sort, such as: