• Log in or sign up for an account here: https://www.sythe.org/login

[Help] Grab usernames from multiline textbox

matto

Member
Joined
Apr 2, 2007
Sythe Gold
0
Messages
89
[Help] Grab usernames from multiline textbox
Hi. I'm trying to make a highscore lookup which grabs a list of usernames from a listbox or multiline textbox, and if the total level is above 900, it puts the username in listbox/multiline textbox 2.

So far, I have managed to get a username from a textbox, then display a message in a label depending on what the total level is.

Here's my code so far:

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim name As String = TextBox1.Text
        Dim src As String 'Declares the variable that will hold the source code
        Dim net As New Net.WebClient() 'Creates a new instance of a WebClient
        src = net.DownloadString("http://hiscore.runescape.com/index_lite.ws?player=" + name) 'Downloads the html source and puts it in the variable src
        Dim tmp() As String = src.Split(",")
        tmp = src.Split(",")

        If (tmp(1) > 900) Then

            Label2.Text = tmp(1)

        ElseIf src.IndexOf("Error 404") > -1 Then
            Label2.Text = "Error"

        Else
            Label2.Text = "Total level is below 900"

        End If
    End Sub

Any help would be appreciated. Thanks
 
[Help] Grab usernames from multiline textbox
You may want to do that on a backgroundworker, because if you experience lag when it navigates, it doesn't lag when the webclient navigates and it's prety useful. Just what I would do in beggining of the backgroundworker is to put checking for illegal cross threads to false, I know that isn't really professional but it gets the job done. :)
 
[Help] Grab usernames from multiline textbox
Uhm....I have no idea what a backgroundworker is lol, I'm a noob at vb.net
 
[Help] Grab usernames from multiline textbox
Something like this?

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim num As Integer = 0
        Dim name As String = TextBox1.Text
        Dim src As String 'Declares the variable that will hold the source code
        Dim net As New Net.WebClient() 'Creates a new instance of a WebClient
        src = net.DownloadString("http://hiscore.runescape.com/index_lite.ws?player=" + name) 'Downloads the html source and puts it in the variable src
        Dim tmp() As String = src.Split(",")
        tmp = src.Split(",")

        Do
            If (tmp.Length < 900) Then
                ' add to first listbox here
                Label2.Text = "Total level is below 900"
            ElseIf src.IndexOf("Error 404") > -1 Then
                Label2.Text = "Error"
            Else
                ' add to second listbox here
            End If

            num = num + 1
        Loop Until num = tmp.Length
    End Sub
 
[Help] Grab usernames from multiline textbox
ah ok, thanks :D

now i need to find out how to load the usernames from a listbox
 
Runescape Gamblingrunescape gambling
Back
Top