string strHostName = string.Empty;
cmbIPAddress.Items.Clear();
// Getting Ip address of local machine...
// First get the host name of local machine.
strHostName = Dns.GetHostName();
// Then using host name, get the IP address list..
IPHostEntry ipEntry = Dns.GetHostByName(strHostName);
IPAddress[] iparrAddr = ipEntry.AddressList;
if (iparrAddr.Length > 0)
{
for (int intLoop = 0; intLoop < iparrAddr.Length; intLoop++)
cmbIPAddress.Items.Add(iparrAddr[intLoop].ToString());
}