using System; using System.Windows.Forms; using System.Net; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { IPHostEntry hostname = Dns.GetHostByName(textBox1.Text ); IPAddress[] ip = hostname.AddressList; textBox2.Text = ip[0].ToString(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } }