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();
}