Method 1
Imports System.Net
Dim _HostName As String = Dns.GetHostName
MsgBox(_HostName)
Dim _IPHostEntry As IPHostEntry = Dns.GetHostByName(_HostName)
For Each _IP As IPAddress In _IPHostEntry.AddressList
MsgBox(_IP.ToString)
Next
Method 2
Imports System.IO
Imports System.Text
MsgBox(GetInternetIPAddress())
Private Function GetInternetIPAddress() As String
Try
Dim _ObjReq As HttpWebRequest = WebRequest.Create("http://automation.whatismyip.com/n09230945.asp")
Dim _ObjRes As HttpWebResponse = _ObjReq.GetResponse()
Dim _ObjStream As Stream = _ObjRes.GetResponseStream()
Dim _ObjSR As StreamReader = New StreamReader(_ObjStream)
Return _ObjSR.ReadToEnd()
Catch ex As Exception
Return String.Empty
End Try
End Function