// edit button private void btnEdit_Click(object sender, EventArgs e) { //search for selected item foreach (ListViewItem findSelect in lsvNames.SelectedItems) { // confirmation box if (MessageBox.Show("Edit " + contactList[findSelect.Index].Name + "?", "Alert", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form editContact = new frmEdit(contactList[findSelect.Index]); // opens new form, sends contact info contactList.RemoveAt(findSelect.Index); //removes from list lsvNames.Items.RemoveAt(findSelect.Index); // removes from box addName(editContact); // adds update } } }
// add new name private void btnNew_Click(object sender, EventArgs e) { Form updateContact = new frmEdit(); addName(updateContact); ; }