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

[VB6] fast and easy highscore lookup...

Status
Not open for further replies.
Joined
May 13, 2007
Sythe Gold
0
Messages
415
Oh god, why do you make this so confusing when it is possible with just a few lines, making it faster and more reliable - whilst still being completely customizable, this literally took me 3minutes to write.

You need these components on Form1:

1) Textbox - (Name it User) // This is where the users name you want to search will be entered.

2) Command Button - (Name it Command1) // This is where the users click when they want to search.

3) Array of Textbox - (Name it TxtValue - Number 0 to 80) // This is where the scores are show, refer to image to see how i set it out. To make an array just make one textbox copy and paste it and you will be asked if you want to add it to a control array - click yes you do.

4) Inet Control - (Name it Inet1) // Used to connect to the high scores page on the internet and then to split the data received.

This is how i set out the form..
highscoremw6.bmp



Next you simply just add this code to the command button by double clicking (I had to save it as an image because sythe refused to post when i have any code in the text).
highscore2em4.bmp


You may post this elsewhere but please credit me (asda123 from sythe.org).
 
Next you simply just add this code to the command button and it will work (type it up yourself though beacause sythe will now allow me to post code...sythe.org).

I don't completely understand what you said.. BUT THANKYOU very much for this =]
 
I don't completely understand what you said.. BUT THANKYOU very much for this =]

Pretty much just double click on the command button then you will have to type the code yourself, because whenever i attempted to post the code it said thread number not found and when there was no code it worked perfectly fine.
 
Mind if i post that in code for you?
Well i dont care if you say yes or no lol soo here it is///

Code:
Private Sub Command1_Click()

Dim strlines() As String
Dim strElemnts() As String
Dim textboxIndex As Integer

textBoxIndex = 0

strLines = Split(Inet1.OpenURL("http://hiscore.runescape.com/index_lite.ws?player=" & User.Text), Char(10))

If InStr(strLines(0), "Page not found") Then
MsgBox "User Not Found!" 'Edit this line if you want to change the error user not found message
GoTo TheEnd
End If

For i = 0 To Ubound(strLines)

	strElements = Split(strLines(i), ","
	If (strElements(x)) = "-1" Then strElements(x) = "NA" 'Edit this line if you want to change the error not in highscores message
		TxtValue(textBoxIndex).Text = strElements(x)
		textBoxIndex = textBoxIndex + 1
	Next x

Next i

TheEnd:
End Sub
 
what is the Inet thing? i dont know where to find taht at ...
Press Ctrl+t, scroll down until you see "Microsoft Internet Transfer Controls 6.0" then check mark the box next to it and click apply.
 
this doesnt work no matter what i do... now it says that Char(10) is not recognized
 
okay well first off dgamemans code has a few errors so i would post the code but the stupid forums wont let me ...

--------------------------------------------------------------
--------------------------------------------------------------


and second of all i dont think i am labeling them right i am naming each box TxtValue0, TxtValue1, TxtValue2, and so forth ...

now when i compile i come up with an error here:


TxtValue(textboxIndex).Text = strElements(x)


it says:

Compile Error:

Sub or Function Cannot be Defined.

and then highlights TxtValue
 
okay well i no longer get that i get a runtime error "424": object required on the line of code that opens the site



strlines = Split(Inet1 .......
 
Member of the Month Winner
Sythe's 10th Anniversary
I use to know how to dynamically create the iNet control using a certain method when declaring the object. I forgot which one, but it saved a bit of time.
 
I use to know how to dynamically create the iNet control using a certain method when declaring the object. I forgot which one, but it saved a bit of time.

Code:
Dim Inet1 As Object
Set Inet1 = CreateObject("InetCtls.Inet")
 
well no crap lol i meant what does coveys code do
If you read his post properly, you will see that he has quoted Swan on creating a Inet control dynamicly. This means that you do NOT have to place it on your form for it to be used, it creates it when the form is loaded (Form_Load) and allows the programmer to save space on his form.



A working demonstration can be found here: http://sythe.org/showthread.php?t=389973
 
it says compile error sub or fucntion not defined then it highlights TxtValue
 
Sorry for bumping this old thread, I know I'm new, but if you can help, please help.
I don't get an error anymore, I fixed the link.

The new link is(?):
http://hiscore.runescape.com/hiscorepersonal.ws?user1= after = the name.

I replaced that link for the old one, and added On Error Resume Next
But now I get this:



Does someone know what's wrong?
 
Sorry for bumping this old thread, I know I'm new, but if you can help, please help.
I don't get an error anymore, I fixed the link.

The new link is(?):
http://hiscore.runescape.com/hiscorepersonal.ws?user1= after = the name.

I replaced that link for the old one, and added On Error Resume Next
But now I get this:

Does someone know what's wrong?

For starters, your URL is wrong.

http://hiscore.runescape.com/index_lite.ws?player= is the correct link, it links to the programmer friendly version, which is why you are getting errors when splitting the info.

Retry with the correct URL and then post your errors, as they will most likely be different with different info to display.
 
1. I can't choose User.text only:
User.Item
User.UBound
User.LBound
User.Count

I don't know which to choose, I did all of them but all of them contains:"Page not found" that msgbox shizzle

my code is:

Code:
Private Sub Command1_Click()

On Error Resume Next
Dim strLines() As String
Dim strElements() As String
Dim textBoxIndex As Integer

textBoxIndex = 0

strLines = Split(Inet1.OpenURL("http://hiscore.runescape.com/index_lite.ws?player=" & Username.UBound), Chr(10))

If InStr(strLines(O), "Page not found") Then
MsgBox ("User not found!"), vbCritical, ("Error")
GoTo TheEnd:
End If

For i = 0 To UBound(strLines)

strElements = Split(strLines(i), ",")
For X = 0 To UBound(strElements)
If (strElements(X)) = "-1" Then strElements(X) = "N/A"
txtValue(textBoxIndex).Text = strElements(X)
textBoxIndex = textBoxIndex + 1
Next X

Next i
TheEnd:

End Sub

User = Username here, I changed it :p
 
Status
Not open for further replies.
duelarena.gg
Back
Top