Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Whats My IP Address ?

5.00/5 (1 vote)
24 Nov 2011CPOL 8.1K  
Dim ipE As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName) Dim AL As Array = Dns.GetHostEntry(vWrkStn).AddressList Dim A As IPAddress For Each A In AL If A.AddressFamily = Sockets.AddressFamily.InterNetwork Then ...
Dim ipE As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)


       Dim AL As Array = Dns.GetHostEntry(vWrkStn).AddressList
       Dim A As IPAddress
       For Each A In AL

           If A.AddressFamily = Sockets.AddressFamily.InterNetwork Then
               IP4 = A
               Exit For
           End If
       Next
       MyIP = IP4.ToString

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)