日期:2014-05-18 浏览次数:21082 次
private void button2_Click(object sender, EventArgs e) { IPHostEntry iphost = Dns.GetHostEntry(textBox1.Text); //string ipaddress = ip.AddressFamily.ToString(); //listBox1.Items.Add(ipaddress); foreach (IPAddress ip in iphost.AddressList) { if(!listBox1.SelectedItems.Contains(ip.ToString())) { listBox1.Items.Add(ip.ToString()); } else { MessageBox.Show("Item Exists!"); } } }
private void button2_Click(object sender, EventArgs e) { IPHostEntry iphost = Dns.GetHostEntry(textBox1.Text); foreach (IPAddress ip in iphost.AddressList) { if(!listBox1.Items.Contains(ip.ToString())) { listBox1.Items.Add(ip.ToString()); } else { MessageBox.Show("Item Exists!"); } } }