void buttonAddSelectedToBaseDetail_Click(object sender, EventArgs e) { TemplateDetailsAddToDataBase detailsAddToDataBase = new TemplateDetailsAddToDataBase(); detailsAddToDataBase.Closing += detailsAddToDataBase_Closing; detailsAddToDataBase.ShowDialog(); }
void detailsAddToDataBase_Closing(object sender, CancelEventArgs e) { TemplateDetailsAddToDataBase detailsAddToDataBase = (TemplateDetailsAddToDataBase)sender; if (detailsAddToDataBase.DialogResult == DialogResult.OK) { List <TemplateDetail> listSelectedDetails = detailListView.SelectedItems; int count = listSelectedDetails.Count; for (int i = 0; i < count; i++) { listSelectedDetails[i].TransferData(true, detailsAddToDataBase.SelectedBaseDetail.ID); } } }