private void lblParent2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Parent clickedParent = null; try { foreach (Parent parent in data.parents) { if (parent.ParentID == child.ParentsIDs[1]) { clickedParent = parent; } } } catch (ArgumentOutOfRangeException) { } if (clickedParent != null) { frmParentReport parentReport = new frmParentReport(clickedParent); parentReport.Show(); } }
//Select single parent - view report private void lstParents_DoubleClick(object sender, EventArgs e) { Parent selectedParent = null; try { int parentID = parentIDList[lstParents.SelectedIndex]; foreach (Parent parent in data.parents) { if (parent.ParentID == parentID) { selectedParent = parent; } } } catch (ArgumentOutOfRangeException) { selectedParent = null; } if (selectedParent != null) { Form parentReport = new frmParentReport(selectedParent, data); parentReport.ShowDialog(); } }