private void EditButton_Click(object sender, EventArgs e) { if (emailAddressList.SelectedIndices.Count > 0) { using (CreateEmailAddressDialog dlg = new CreateEmailAddressDialog((EmailOptions)emailAddressList.Items[emailAddressList.SelectedIndices[0]].Tag)) { DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) { emailAddressList.Items[emailAddressList.SelectedIndices[0]].Tag = dlg.Email; } } } }
private void AddButton_Click(object sender, EventArgs e) { using (CreateEmailAddressDialog dlg = new CreateEmailAddressDialog()) { DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) { ListViewItem item = new ListViewItem(dlg.Email.EmailAddress) { Tag = dlg.Email }; emailAddressList.Items.Add(item); } } }