All pastes #795503 Raw Edit

Unnamed

public text v1 · immutable
#795503 ·published 2007-11-24 04:55 UTC
rendered paste body
Imports System.Threading
Imports System.IO
Public Class Form1
    Dim strPageSource As String
    Private Sub BtnLookUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLookup.Click
        Dim strWebsite, strItemName, strSavedStatsPath As String
        strItemName = TxtItem.Text
        strWebsite = "http://hiscore.runescape.com/index_lite.ws?player="
        strWebsite = strWebsite + strItemName
        strSavedStatsPath = Application.StartupPath & "\SavedStats\"
        strPageSource = GetPageSource(strWebsite)
    End Sub
    Private Function GetPageSource(ByVal strWebsite As String)
        Dim Website As Object
        Dim intX As Integer = 0
        'Website = CreateObject("MSXML2.XMLHTTP")
        Website = CreateObject("MSXML2.serverXMLHTTP")
        Website.open("GET", strWebsite)
        Website.send()
        Do Until Website.ReadyState = 4
            Thread.Sleep(10)
            intX += 1
            If intX > 100 Then
                MessageBox.Show("Unable to connect to runescape highscore.", "Oops!", MessageBoxButtons.OK)
                Return Nothing
                Exit Function
            End If
        Loop
        Return Website.responsetext
    End Function
End Class