Home > C#, Code Snippets, DOTNET > Get IP address from a windows forms application

Get IP address from a windows forms application

using System.Net;
 
 
IPHostEntry he = Dns.GetHostByName(Dns.GetHostName());
Text = he.AddressList[0].ToString(); // returns IP address

Well, this will return multiple IP addresses if you have multiple IPs (multiple ethernet cards etc.)

VN:F [1.9.18_1163]
Rating: 5.0/5 (2 votes cast)
Get IP address from a windows forms application, 5.0 out of 5 based on 2 ratings

No related posts.

Categories: C#, Code Snippets, DOTNET