Use System.Net namespace.
private void button1_Click(object sender, RoutedEventArgs e)
{
IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
IPAddress[] address = hostEntry.AddressList;
textBox1.Text = address.GetValue(1).ToString();
//MessageBox.Show(address.GetValue(1).ToString());
}
Hope this helps you.