IP Viewer [Free Project | Tutorial]

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
13 posts Page 1 of 2
Contributors
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

IP Viewer [Free Project | Tutorial]
Code
This is my tutorial on how to make an application that retrieves your Internal, External and MAC Address.
You will need:
1 Button: Name it 'Get Information'
3 Text box's
3 labels

Place textbox1 at the top of your form and put a label next to it, change the text of the label to 'Internal IP Address'
Place textbox2 under textbox1 and then place a label next to the textbox2 and change the text of the label to 'External IP Address'
Place textbox3 under textbox2 and then place a label next to the textbox3 and change the text of the label to 'MAC Address'
Place the button under all of textbox's and labels, re size, edit, design your form however you would like it. Then add the code and enjoy!
Code: Select all
Imports System.Net
Imports System.Net.NetworkInformation
Imports System.Net.NetworkInformation.NetworkInterface
Public Class Form1
    'Getting the Mac Address
    Function getMacAddress()
        Dim nics() As NetworkInterface = _
              NetworkInterface.GetAllNetworkInterfaces
        Return nics(0).GetPhysicalAddress.ToString
    End Function
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'External IP
        Dim webclient As New System.Net.WebClient
        Dim ipaddress As String
        ipaddress = System.Text.Encoding.ASCII.GetString(( _
        webclient.DownloadData("http://automation.whatismyip.com/n09230945.asp")))
        TextBox1.Text = ipaddress

        'Internal IP
        Dim Ip As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName)


        For Each internalIP As Net.IPAddress In Ip.AddressList
            If internalIP.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then
                TextBox2.Text = internalIP.ToString
            End If
        Next

        'MAC Address
        TextBox3.Text = getMacAddress()
    End Sub
End Class


Happy coding!
-Code
You do not have the required permissions to view the files attached to this post.
Last edited by Code on Fri Sep 23, 2011 2:03 am, edited 1 time in total.
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Good tut, but insted of "http://automation.whatismyip.com/n09230945.asp", you can use "http://whatismyip.org/", since whatismyip.com sometimes changes automation address.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

M1z23R wrote:
Good tut, but insted of "http://automation.whatismyip.com/n09230945.asp", you can use "http://whatismyip.org/", since whatismyip.com sometimes changes automation address.
But you would then have to parse the tag that contains the IP address. The automation page changing is easy handled, go to the automation rules page http://www.whatismyip.com/faq/automation.asp and search for the right HTMLElement and get its value.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

M1z23R wrote:
Good tut, but insted of "http://automation.whatismyip.com/n09230945.asp", you can use "http://whatismyip.org/", since whatismyip.com sometimes changes automation address.
I had previously looked that information up and that url is for developers, its a perma link :D goofy;
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Code wrote:
M1z23R wrote:
Good tut, but insted of "http://automation.whatismyip.com/n09230945.asp", you can use "http://whatismyip.org/", since whatismyip.com sometimes changes automation address.
I had previously looked that information up and that url is for developers, its a perma link :D goofy;
It is not a permanent link, unfortunately :( the link has changed several times, and i needed to change the link in one of my applications because i though it was permanent. :(
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

MrAksel wrote:
Code wrote:
M1z23R wrote:
Good tut, but insted of "http://automation.whatismyip.com/n09230945.asp", you can use "http://whatismyip.org/", since whatismyip.com sometimes changes automation address.
I had previously looked that information up and that url is for developers, its a perma link :D goofy;
It is not a permanent link, unfortunately :( the link has changed several times, and i needed to change the link in one of my applications because i though it was permanent. :(
:(
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

Added free download :D
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

No need for tag search :)

This works perfectly for me
Code: Select all
   Dim theRequest As WebRequest = WebRequest.Create("http://whatismyip.org")
        Dim theResponse As WebResponse = CType(theRequest.GetResponse, HttpWebResponse)
        Dim theReader As New StreamReader(theResponse.GetResponseStream())
        TextBox1.Text = theReader.ReadToEnd()
        theReader.Close()

Edit:

I don't know if you read it carefully :) i said "http://whatismyip.ORG" not "http://whatismyip.COM" :D
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

M1z23R wrote:
I don't know if you read it carefully :) i said "http://whatismyip.ORG" not "http://whatismyip.COM" :D
Ohh :P my mistake :D
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
hacker007
Just Registered
Just Registered
Posts: 1
Joined: Tue Jul 24, 2012 10:16 am

cooll;
Nice tutorial gud bro!!!
13 posts Page 1 of 2
Return to “Tutorials”