private void btnEmail_Click(object sender, EventArgs e) { Form frmEmail = new frmEmail(); DialogResult dlg = frmEmail.ShowDialog(); if (dlg == DialogResult.OK && SharedData.sEmail.Length > 0) { bool bExists = false; foreach (string s in cbxEmail.Items) { if (s.ToLower() == SharedData.sEmail.ToLower()) { bExists = true; } } if (bExists) { MessageBox.Show("The address entered already exists.", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { cbxEmail.Items.Add(SharedData.sEmail); cbxEmail.SelectedIndex = cbxEmail.Items.Count - 1; } SharedData.sEmail = ""; } return; }