Beispiel #1
0
        //Form for Editing Detail of Product
        private void btn_EditDetails_Click(object sender, EventArgs e)
        {
            //EditDetails Form is Edited AddProduct form
            frm_AddProduct frm = new frm_AddProduct();

            #region EditDetailsForm Procedure
            //Fill EditDetails Form with Data From DataGridV_Product
            frm.txtb_ProductID.Text  = dataGridV_Product.CurrentRow.Cells[0].Value.ToString();
            frm.txtb_Label.Text      = dataGridV_Product.CurrentRow.Cells[1].Value.ToString();
            frm.txtb_Price.Text      = dataGridV_Product.CurrentRow.Cells[3].Value.ToString();
            frm.txtb_Quantity.Text   = dataGridV_Product.CurrentRow.Cells[2].Value.ToString();
            frm.cmbb_CategoryID.Text = dataGridV_Product.CurrentRow.Cells[4].Value.ToString();
            //Edit Form Title
            frm.Text = "Edit : " + dataGridV_Product.CurrentRow.Cells[1].Value.ToString();
            //Edit Button Title
            frm.btn_OK.Text = "Update";
            //Disable ProductID Editing
            frm.txtb_ProductID.ReadOnly = true;
            //For Control (Allowed/Banned) ProductID Replication Validate
            //False = Replication Banned In case Of Adding/True = Replication Allowed in case of Editing
            frm.IDReplicationState = true;
            //Get The Image Data and turn it into Image
            byte[]       PicArr2 = (byte[])Pro.GetPicture(this.dataGridV_Product.CurrentRow.Cells[0].Value.ToString()).Rows[0][0];
            MemoryStream MS      = new MemoryStream(PicArr2);
            frm.pictureB_ProductImage.Image = Image.FromStream(MS);
            #endregion
            //refresh DataGridView
            ViewAllProducts();
            frm.ShowDialog();
        }