コード例 #1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            FRMAddProduct modifyProductForm = new FRMAddProduct();

            modifyProductForm.addProduct = false;
            modifyProductForm.product    = p;

            DialogResult result = modifyProductForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                p = modifyProductForm.product;
                this.DisplayProduct();
            }

            else if (result == DialogResult.Retry)
            {
                this.GetProduct(p.Code);
                if (p != null)
                {
                    this.DisplayProduct();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //create new form object
            FRMAddProduct addProductForm = new FRMAddProduct();

            addProductForm.addProduct = true;
            DialogResult result = addProductForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                p = addProductForm.product;
                txtProductCode.Text = p.Code;
                this.DisplayProduct();
            }
        }