private void BtnAddProduct_Click_1(object sender, EventArgs e)
        {
            try
            {
                AdminAddNewProducts addProduct = new AdminAddNewProducts(this);

                //if the add product button is click
                //save button is present in the form
                addProduct.BtnSave.Visible = true;

                //change the location of save button next to cancel button
                addProduct.BtnSave.Location = new System.Drawing.Point(133, 515);

                //update button is not present in the form
                addProduct.BtnUpdate.Visible = false;
                addProduct.Show();

                // Populate the Combobox with category
                addProduct.PopulateCategoryInCombobox();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Oops Something came up", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Edit")
            {
                AdminAddNewProducts Frp = new AdminAddNewProducts(this);
                Frp.BtnSave.Enabled   = false;
                Frp.BtnUpdate.Enabled = true;
                Frp.lbl1.Text         = "Update Product";

                Frp.lblID.Text       = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                Frp.txtCode.Text     = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
                Frp.txtDesc.Text     = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                Frp.txtPrice.Text    = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
                Frp.txtCategory.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
                Frp.txtQuan.Text     = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
                Frp.txtWarnqty.Text  = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString();

                ShowAllProductsInDatabase();
                Frp.BtnSave.Visible   = false;
                Frp.BtnUpdate.Visible = true;

                // Populate the Category Combobox
                Frp.PopulateCategoryInCombobox();
                Frp.Show();
            }
            else if (colName == "Delete")
            {
                if (MessageBox.Show("Are you sure you want to delete this Product's Information?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("Delete FROM tblProduct WHERE id like '" + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + "'", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Product's Information Successfully Deleted.", "Product Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowAllProductsInDatabase();
                }
            }
        }
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            //File a switch case statement
            switch (e.ClickedItem.Name.ToString())
            {
            case "edi":

                contextMenuStrip1.Hide();
                AdminAddNewProducts c = new AdminAddNewProducts(this);

                c.lblID.Text       = ID.Text;
                c.txtDesc.Text     = label3.Text;
                c.txtCode.Text     = label2.Text;
                c.txtCategory.Text = label5.Text;
                c.txtPrice.Text    = label4.Text;
                c.txtQuan.Text     = label6.Text;
                c.txtWarnqty.Text  = label7.Text;

                //Hide the Save Button
                c.BtnSave.Visible = false;

                // Populate the Category Combobox
                c.PopulateCategoryInCombobox();

                //Show Only the Update Button
                c.BtnUpdate.Visible = true;
                c.lbl1.Text         = "Update Product Information";
                c.txtQuan.Enabled   = false;
                c.Focus();
                c.Show();

                break;

            case "del":

                contextMenuStrip1.Hide();
                if (MessageBox.Show("Are you sure you want to delete the Product Information?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("DELETE FROM tblProduct WHERE id like '" + ID.Text + "'", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Product Information has been successfully Deleted", "Product Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowAllProductsInDatabase();
                }

                break;

            case "deta":

                contextMenuStrip1.Hide();

                AdminProductDetails pd = new AdminProductDetails();

                pd.lblWhatProduct.Text  = label3.Text;
                pd.lblWhatCategory.Text = "This product is under " + label5.Text + "  Category.";
                pd.lblWhatID.Text       = ID.Text;
                pd.lblWhatCode.Text     = label2.Text;
                pd.lblWhatPrice.Text    = "₱  " + label4.Text + " ";
                pd.lblWhatStatus.Text   = label9.Text;
                pd.Show();

                break;
            }
        }