Inet control?
''' <summary>Download the content (Html) code of a webpage.</summary>
''' <param name="Url">The Url of the webpage to download.</param>
Public Function DownloadString(ByVal Url As String) As String
Static Client As New System.Net.WebClient()
Return Client.DownloadString(Url)
End Function
Never use the INet control in .NET languages. Use the WebClient class instead:
Code:''' <summary>Download the content (Html) code of a webpage.</summary> ''' <param name="Url">The Url of the webpage to download.</param> Public Function DownloadString(ByVal Url As String) As String Static Client As New System.Net.WebClient() Return Client.DownloadString(Url) End Function
NameBox.Text.Replace(" ", "_")
Label1.Text = "Retriving hiscore data..."
Dim UName As String = NameBox.Text
Dim HiData As String = "http://hiscore.runescape.com/index_lite.ws?player=" & UName
Dim WebC As New Net.WebClient()
Dim UData = WebC.DownloadString(HiData)
Dim Skills = 0
For Each Line As String In HiData.Split(vbNewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
Skills += 1
TextBox1.Text = Skills
Next
Dim EditData = UData.Replace("-1", "N/A")
Label1.Text = EditData
You are splitting the Url of the hiscores page, not the downloaded data.
Replace HiData.Split with UData.Split, and it should work.
For Each Line As String In UData.Split(vbNewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
Dim SplitData = Line.Split(",")
Dim Rank = Integer.Parse(SplitData(0))
Dim Level = Integer.Parse(SplitData(1))
Dim Experience? = If(SplitData.Length = 3, Integer.Parse(SplitData(2)), Nothing)
Next
NameBox.Text.Replace(" ", "_")
Dim UName As String = NameBox.Text
Dim HiData As String = "http://hiscore.runescape.com/index_lite.ws?player=" & UName
Dim WebC As New Net.WebClient()
Dim UData = WebC.DownloadString(HiData)
Dim Skills = 0
For Each Line As String In UData
Dim EditData = UData.Replace("-1", "N/A")
Dim SplitData = UData.Split(",")
Dim Rank = Integer.Parse(SplitData(0))
Dim Level = Integer.Parse(SplitData(1))
Dim Experience = (SplitData(2))
Label2.Text = "Rank: " + Rank.ToString + " Total Level: " + Level.ToString + " Total XP: " + Experience.ToString
Me.Text = "Hiscore Grabber (" + UName + ": TL:" + Level.ToString + ")"
Next