private void prtSlctdPrdct_Click(object sender, EventArgs e)
 {
     // instanciate on object of the crystal report: rpt_single_unit for selected product report
     Reports.rpt_single_unit singleUnitCrystalReport = new Reports.rpt_single_unit();
     //pass the selected product id to the crystal report (the report it self uses a stored procedure in the db with a single parameter "product_id")
     singleUnitCrystalReport.SetParameterValue("@product_id", Convert.ToInt32(this.dgvProductsLst.CurrentRow.Cells[0].Value.ToString()));
     // obj from the form of reports
     Views.frm_reports reportsFrm = new Views.frm_reports();
     //bind the crystal report to the crystal report viewer on the reports form
     reportsFrm.crystalReportViewer1.ReportSource = singleUnitCrystalReport;
     reportsFrm.ShowDialog();
 }
        private void prtSlctCat_Click(object sender, EventArgs e)
        {
            // instanciate on object of the crystal report (report for printing all products stored in db "stored proc called get all products")
            Reports.rpt_singleCategoryProducts rptSingleCatProducts = new Reports.rpt_singleCategoryProducts();
            // obj from the form of reports
            Views.frm_reports reportsFrm = new Views.frm_reports();

            // refresh the sub report
            new Reports.rpt_all_products().Refresh();

            // refresh the report in case if a change has made in the database
            rptSingleCatProducts.Refresh();

            rptSingleCatProducts.SetParameterValue("@cat_id", Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString()));

            //bind the crystal report to the crystal report viewer on the reports form
            reportsFrm.crystalReportViewer1.ReportSource = rptSingleCatProducts;
            reportsFrm.ShowDialog();
        }