private void set_button1_Click(object sender, EventArgs e) { string hostname = textBox1.Text; ping = HPing.ObjectFactory(textBox1.Text); if (ping != null) { textBox2.Text = ping.GetTargetAddress(); } else { textBox2.Text = ""; } }