Sometimes we need to get the IP Address of the current PC. Under a Event we can get the IP address Easily by using the Code:
string myHost = System.Net.Dns.GetHostName();
string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[1].ToString();
MessageBox.Show("My PC Name : "+myHost + "\nMy IP Address : " + myIP);
string myHost = System.Net.Dns.GetHostName();
string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[1].ToString();
MessageBox.Show("My PC Name : "+myHost + "\nMy IP Address : " + myIP);
Comments
Post a Comment