This is the Xml file where the high scores are saved:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<User Name="Player1">
<HighScore>626</HighScore>
</User>
<User Name="Player2">
<HighScore>352</HighScore>
</User>
</Root>
And this is the code to retrieve the highscores:
Dim m_xmlr As XmlTextReader
m_xmlr = New XmlTextReader("C:\Users\Nicolas\Desktop\Scores.xml")
m_xmlr.WhiteSpaceHandling = WhiteSpaceHandling.NONE
m_xmlr.Read()
m_xmlr.Read()
While Not m_xmlr.EOF
m_xmlr.Read()
If Not m_xmlr.IsStartElement() Then
Exit While
End If
Dim Username = m_xmlr.GetAttribute("Name")
m_xmlr.Read()
Dim HighScore = m_xmlr.ReadElementString("HighScore")
End While
m_xmlr.Close()
But this code only retrieves the last high score how can i get all the players with their high score? for example have two list boxes one for the players name and the second for the high scores and for each player in the Xml file the player's name adds to the first list box and his high score gets added to the second.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<User Name="Player1">
<HighScore>626</HighScore>
</User>
<User Name="Player2">
<HighScore>352</HighScore>
</User>
</Root>
And this is the code to retrieve the highscores:
Dim m_xmlr As XmlTextReader
m_xmlr = New XmlTextReader("C:\Users\Nicolas\Desktop\Scores.xml")
m_xmlr.WhiteSpaceHandling = WhiteSpaceHandling.NONE
m_xmlr.Read()
m_xmlr.Read()
While Not m_xmlr.EOF
m_xmlr.Read()
If Not m_xmlr.IsStartElement() Then
Exit While
End If
Dim Username = m_xmlr.GetAttribute("Name")
m_xmlr.Read()
Dim HighScore = m_xmlr.ReadElementString("HighScore")
End While
m_xmlr.Close()
But this code only retrieves the last high score how can i get all the players with their high score? for example have two list boxes one for the players name and the second for the high scores and for each player in the Xml file the player's name adds to the first list box and his high score gets added to the second.