public ip address

  • Thread starter Thread starter karim
  • Start date Start date
K

karim

Hi,
I'm using vb08 and I'm trying to get the public ip address. I used this code
but for some reason it's not working:
Dim lblPIp As IPAddress
lblPIp = Dns.GetHostEntry(Dns.GetHostName).AddressList.GetValue(0)

Any ideas would be appreciated.
 
Hi,
I'm using vb08 and I'm trying to get the public ip address. I used this code
but for some reason it's not working:
Dim lblPIp As IPAddress
        lblPIp = Dns.GetHostEntry(Dns.GetHostName).AddressList.GetValue(0)

Any ideas would be appreciated.

Hi,

That can be retrieved using a a 3rd-party IP detection web server
cınbined with WebClient object:

Using client As New System.Net.WebClient
' Get it in MsgBox
MsgBox(client.DownloadString _
("http://www.whatismyip.com/automation/n09230945.asp"))
End Using

Onur Güzel
 
Thank you Onur Güzel, works great. But would I be able to view the ip
address in a label/text box instead of a message?
 
Back
Top