How Get Information's About Your Internet In VB.NET

Today i will show you how you can obtain the computers mac address, local ip and outgoing ip
First create a new project


1. Open Visual Studio or Visual Basic.
2. Create a new windows form project and name it whatever you want.

Now to add the controls.
1. Add 3 textboxes, name the first outtext the second iptext and the last mactext.
2. add 4 buttons, name the first copyout the second copyip and the last copymac, you dont need to rename
the last its just to get all the information.
3. Set the text on the copy buttons to copy.

Now to the code first you add at the top of your code.

Imports System.Net

then you add this below public class.
 Dim ip As New WebClient

Now add this so that when you click on the buttons you copy it
    Private Sub CopyOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyOut.Click
        Clipboard.SetText(OutText.Text)
    End Sub

    Private Sub CopyIp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyIp.Click
        Clipboard.SetText(IPtext.Text)
    End Sub

    Private Sub CopyMac_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyMac.Click
        Clipboard.SetText(MACText.Text)
    End Sub
Now we will add the code that gets the mac address the outgoing ip and the local ip, add this to your code.
Private Sub getoutip()
'Get outgoing ip
        Try
            OutText.Text = ip.DownloadString("http://www.networksecuritytoolkit.org/nst/tools/ip.php/")

        Catch ex As Exception
            OutText.Text = "No connection"
        End Try
    End Sub

    Private Sub obtip()
        'MAC Address
        For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
            MACText.Text = String.Format("{2}", nic.Description, Environment.NewLine, nic.GetPhysicalAddress())
            Exit For
        Next
'Get local ip
        Dim host As String = System.Net.Dns.GetHostName()
        Dim LocalHostaddress As String = System.Net.Dns.GetHostByName(host).AddressList(0).ToString()
        IPtext.Text = LocalHostaddress
    End Sub