private void btnAdd_Click(object sender, EventArgs e) { // open the add/modify form in the add mode frmPackageDataChange addPackageForm = new frmPackageDataChange(); addPackageForm.addMode = true; DialogResult result = addPackageForm.ShowDialog(); if (result == DialogResult.OK) { // copy the newly added package from the add/modify form to this form and display the package data lstSuppliersProducts.DataSource = null; package = addPackageForm.package; this.DisplayPackage(); } }
private void btnModify_Click(object sender, EventArgs e) { // open the add/modify form in the modify mode frmPackageDataChange modifyPackageForm = new frmPackageDataChange(); modifyPackageForm.addMode = false; modifyPackageForm.package = package; DialogResult result = modifyPackageForm.ShowDialog(); if (result == DialogResult.OK) { // copy the modified package from the add/modify form to this form and display the package data after modification package = modifyPackageForm.package; this.DisplayPackage(); } else if (result == DialogResult.Retry) { btnSearch_Click(sender, e); if (package != null) this.DisplayPackage(); else this.ClearControls(); } }