private void btnAdd_Click(object sender, EventArgs e) { // open the add/modify form in the add mode frmSupplierDataChange addSupplierForm = new frmSupplierDataChange(); addSupplierForm.addMode = true; DialogResult result = addSupplierForm.ShowDialog(); if (result == DialogResult.OK) { // copy the newly added product from the add/modify form to this form and display the product data dgvProducts.DataSource = null; dgvContacts.DataSource = null; supplier = addSupplierForm.supplier; this.DisplaySupplier(); } }
private void btnModify_Click(object sender, EventArgs e) { // open the add/modify form in the modify mode frmSupplierDataChange modifySupplierForm = new frmSupplierDataChange(); modifySupplierForm.addMode = false; modifySupplierForm.supplier = supplier; DialogResult result = modifySupplierForm.ShowDialog(); if (result == DialogResult.OK) { // copy the modified supplier from the add/modify form to this form and display the supplier data after modification supplier = modifySupplierForm.supplier; this.DisplaySupplier(); } else if (result == DialogResult.Retry) { btnSearch_Click(sender, e); if (supplier != null) this.DisplaySupplier(); else this.ClearControls(); } }