get ip address of this pc with windows app

  • Thread starter Thread starter cj
  • Start date Start date
CJ,

This is how to get the internal IP address:

Imports System.Net

Dim ipAddress As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
Me.Text = ipAddress.AddressList.GetValue(0).ToString

I hope this helps,
 
had to change it a bit but it works

Dim ipAddressInfo As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())
Dim ipAddress As String = ipAddressInfo.AddressList.GetValue(0).ToString
 
Hi CJ,

You're right that Dns.GetHostByName is obsolete in .NET 2.0,
Dns.GetHostEntry should be used instead.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top