private void btnAdd_Click(object sender, System.EventArgs e) { DialogResult result; String ip = null; AddressInput input = new AddressInput(); result = input.ShowDialog(this); if (result == DialogResult.OK) { ip = input.IP.ToString(); } else if (result == DialogResult.Cancel) { return; } input.Dispose(); if (ip != null) { if (!ips.Contains(ip)) { ips.Add(ip); listBox1.Items.Add(ip); } } }
private bool addIp() { DialogResult result; AddressInput input = new AddressInput(); result = input.ShowDialog(this); if (result == DialogResult.OK) { CheckTool.host = input.IP; CheckTool.port = 0; input.Dispose(); return(true); } else if (result == DialogResult.Cancel) { input.Dispose(); return(false); } return(false); }