private void btnPhone_Click(object sender, EventArgs e) { Form frmPhone = new frmPhone(); DialogResult dlg = frmPhone.ShowDialog(); if (dlg == DialogResult.OK && SharedData.sPhone.Length > 0) { bool bExists = false; foreach (string s in cbxPhone.Items) { if (s.ToLower() == SharedData.sPhone.ToLower()) { bExists = true; } } if (bExists) { MessageBox.Show("The number entered already exists.", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { cbxPhone.Items.Add(SharedData.sPhone); cbxPhone.SelectedIndex = cbxPhone.Items.Count - 1; } SharedData.sPhone = ""; } return; }
private void btCon_Click(object sender, EventArgs e) { frmPhone frm = new frmPhone(); if (frm.ShowDialog() == DialogResult.OK) { phone = frm.txPhone; Connect(); lstContent.Items.Clear(); } }