PDA

Click to See Complete Forum and Search --> : [TuT] Get Your IP [VB6]


noob of vb6
Apr 4th, 2011, 09:35 AM
Hi everybody here ! :)
I`m noob of vb6 and today i will show u how to make a program that shows your IP ! :) Its noob friendly and everyone can do it ! :)

Lets start !

Requirements :
- Visual Basic 6

Now make a new form , edit it how you want ...
Then add to this form :

- 1 button ( Change its caption to " Get IP " )
- 1 textbox ( Leave it blank )

Don`t change anything else at the properties !

And you need Inet component , go to the menu called Project => Component => And choose "Microsoft Internet Transfer Controls 6.0" , click Apply and OK ! :)

Then at the toolbox that contains controls you should see the icon of Inet control ! Click it and then add Inet to your form. After finishing that step your form will look like this :

http://i54.tinypic.com/v6q0zq.png


Now lets go to Whatismyip.com , you will see your IP there !
Double click on the page ang view the page source :
Press on ur keyboard CTRL + F (Find) and search for the string below without quotes :
" Your IP Address Is: "
There , close the string above , you should see the following HTML comment :

<!--Please set your code to scrape your IP from www.whatismyip.com/automation/n09230945.asp For more info, please see our "Recommended Automation Practices" thread in the Forum.-->

So we need that URL for our program :
www.whatismyip.com/automation/n09230945.asp


You can check it by opening it in your webrowser , you should only your IP , if you double click in the page and view its source , you will view only your IP , and not any other HTML code.. !
So thats perfect for our program !

Right now we're going to add a a little code to our program , to make it functional.
Double click on the button in our form with the caption "Get IP".
Now there between that :

Private Sub Command1_Click()

End Sub

We'll add this little piece of code :

Text1.Text = Inet1.OpenURL("www.whatismyip.com/automation/n09230945.asp")

This code will get the IP from WhatIsMyIp !

Now run the program by pressing F5 on your keyboard !
Click "Get IP" and after a few seconds , you should see at the textbox your IP ! :)

Hope you like this noob friendly tutorial ! If you do , please +REP ! :p
Its my first one here.
Enjoy !!
Please don't copy that in other forums without my permission , if you do , at least give credit to me !

Regards => noob of vb6 ! :)

BenJones
Apr 4th, 2011, 10:13 AM
Nice tut tho I think it should be moved to the code bank