Obtaining IP

The System.Net namespace has the Dns class, which has some
static methods that can do what you need.

GetHostName retrieve the host name of the local computer, then
Resolve takes this host name and returns an IPHostEntry, whose
AddressList contains the IP address of the local computer.

Code:
MessageBox.Show(System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList(0).ToString)
 
Back
Top