Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I have a small project that creates invoices
in the first window form I have text boxes with a datagridview
my object is to display the viewagrideview values that are added manually via form1 in the Crystal2 report form
my project does not contain a database
somone help me


What I have tried:

in the form 1 i put this code:
private void btnimp_Click(object sender, EventArgs e)

       {




           new Form2((txtfact.Text), (txtclient.Text), (txtadresse.Text), (txtmf.Text), (txtnr.Text), (txtvr.Text),
               (txtincotem.Text), (txthawb.Text), (txtexpd.Text), (txtdest.Text), (txtdesmcd.Text), (txtnbcol.Text),
               (txtpbrt.Text), (txtvolum.Text), (txtpt.Text), (txtvaleur.Text), (txtorg.Text), (cmbcodar.Text), (txtcomp.Text), (txtvol1.Text), (txtlta.Text),
               (txtcmth.Text), (txtctva.Text), (txtTF.Text), (txtNAP.Text)).ShowDialog();

           DataSet ds = new DataSet();
           DataTable resultat2 = new DataTable();
           resultat2.Columns.Add(new DataColumn("Code article", typeof(string)));
           resultat2.Columns.Add(new DataColumn("Designation", typeof(string)));
           resultat2.Columns.Add(new DataColumn("Montant HT", typeof(double)));
           resultat2.Columns.Add(new DataColumn("Total MHT", typeof(double)));
           resultat2.Columns.Add(new DataColumn("Devise", typeof(string)));
           resultat2.Columns.Add(new DataColumn("TVA%", typeof(double)));
           dataGridView1.DataSource = resultat2;
           foreach (DataGridViewRow dgv in dataGridView1.Rows)
           {
               resultat2.Rows.Add(dgv.Cells[0].Value, dgv.Cells[1].Value, dgv.Cells[2].Value, dgv.Cells[3].Value, dgv.Cells[4].Value, dgv.Cells[5].Value);

           }

                       ds.Tables.Add(resultat2);



in the second form :
private void Form2_Load(object sender, EventArgs e)
       {


           CrystalReport12 cr = new CrystalReport12();

cr.SetParameterValue("txtctva", TTva);
            cr.SetParameterValue("txtTF", TTft);
            cr.SetParameterValue("txtNAP", TTnap);

           
            crystalReportViewer1.ReportSource = cr;


           

            


            crystalReportViewer1.Refresh();
            
        }
Posted
Comments
[no name] 4-Sep-18 14:09pm    
At some point, you "connect" the "report" (engine) with the "data" ... I don't see that happening. I'm pretty sure CR has "examples".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900