//opens the Products section for the active package. if there is no active package private void btnEditProducts_Click(object sender, EventArgs e) { if (isValidData()) { if (activePackage != null) { frmEditProductSuppliers myForm = new frmEditProductSuppliers(activePackage); myForm.ShowDialog(); } else { createPackage(); int PackageId = TravelExpertsDB.TravelExpertsDB.AddPackage(newPackage); newPackage.PackageId = PackageId; activePackage = newPackage; frmEditProductSuppliers myForm = new frmEditProductSuppliers(activePackage); myForm.ShowDialog(); } if (activePackage.productSuppliers != null) { lvProductSuppliers.Items.Clear(); foreach (Product_Supplier ps in activePackage.productSuppliers) { ListViewItem lvi = new ListViewItem(new[] { ps.ProductName, ps.SupName }); lvProductSuppliers.Items.Add(lvi); } } } }