Example #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     // open the add/modify form in the add mode
     frmProductDataChange addProductForm = new frmProductDataChange();
     addProductForm.addMode = true;
     DialogResult result = addProductForm.ShowDialog();
     if (result == DialogResult.OK)
     {
         // copy the newly added product from the add/modify form to this form and display the product data
         dgvSuppliers.DataSource = null;
         product = addProductForm.product;
         this.DisplayProduct();
     }
 }
Example #2
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     // open the add/modify form in the modify mode
     frmProductDataChange modifyProductForm = new frmProductDataChange();
     modifyProductForm.addMode = false;
     modifyProductForm.product = product;
     DialogResult result = modifyProductForm.ShowDialog();
     if (result == DialogResult.OK)
     {
         // copy the modified product from the add/modify form to this form and display the product data after modification
         product = modifyProductForm.product;
         this.DisplayProduct();
     }
     else if (result == DialogResult.Retry)
     {
         btnSearch_Click(sender, e);
         if (product != null) this.DisplayProduct();
         else this.ClearControls();
     }
 }