locked
The RuneScape Hiscore; How to get the data into my Form?

    Question

  • Hello...

    I'm new at programming, and maybe this is a bit advanced; I will make a form, who takes data from the Runescape Hiscore list (hiscore.runescape.com) and I do only know very few thing about HTML...

    I have road a thread at the MSDN Forum about this (
    The thread here), but I can't figure out, how to get the XP, rank and level into my form, and then show it. I have seen this done before (at a Runescape fansite; http://www.runehq.com/RHQCalcView.php?id=00883), and I want to make somthing like that.

    Runescape also have links to do this, for
    example http://hiscore.runescape.com/hiscorepersonal.ws?user1=dressingoak (Goes to my account hiscore, at hiscore.runescape.com)
    They also have another link, 
    http://hiscore.runescape.com/index_lite.ws?player=Dressingoak (My account again; if you see this link, you better know at bit about it: http://www.runescape.com/kbase/viewarticle.ws?article_id=750#hiscores)

    How do I get the data from the site into my form, so I can preview the level, rank and XP in Labels, TextBoxes, etc.?

    My code is following. I don't fully understand it all, I must say :D

    I have added a WebBrowser to my form:

    Public Class Form1  
     
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.ObjectByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)  
            Dim TableColumn As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("a")  
            Dim rank As String 
            Dim level As String 
            Dim XP As String 
            Dim cell As HtmlElement  
            For Each cell In TableColumn  
                If cell.OuterText.Contains("Cooking"Then 
                    Dim target As HtmlElement = cell  
                    target = cell.Parent.NextSibling  
                    rank = target.OuterText  
                    target = target.NextSibling  
                    level = target.OuterText  
                    target = target.NextSibling  
                    XP = target.OuterText  
                    MsgBox("Rank=" & rank & " Level=" & level & " XP=" & XP)  
                End If 
            Next 
        End Sub 

    And then I have a TextBox (for entering and a Button:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
            WebBrowser1.Url = New Uri("http://hiscore.runescape.com/hiscorepersonal.ws?user1=" + TextBox1.Text)  
    End Sub 

    The code is taken directly from the thread, I have road (The thread here)

    Hope that someone can help me :D

    Dressingoak
    Sunday, July 20, 2008 11:42 AM

Answers

  • Hi Dressingoak,

    Based on your post, my understanding of your question is that you need to parse the html text to get the required data in your application. You can read Using the Managed HTML Document Object Model for your reference. The managed HTML document object model (DOM) provides a wrapper based on the .NET Framework for the HTML classes exposed by Internet Explorer. Use these classes to manipulate HTML pages hosted in the WebBrowser control, or to build new pages from the beginning.

    Best regards,
    Riquel


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, July 23, 2008 12:20 PM
    Moderator