0

Dear Frien,
I am working in C# .... I nedd Help/.]
I created FROM1 which has DATAGRIDVIEW and fetched data from Database,and on the Form2 has Crystal Report Design , how can transfer data from Datagrideview of FORM1 to Crystal Report of FORM2..........
Code is bellow-:

private void btn_CrtRep_Click(object sender, EventArgs e)
        {

            {
                pur_DS ds = new pur_DS();
                int file = dataGridView1.Rows.Count;

                for (int i = 0; i <= file - 2; i++)
                {
                    ds.Tables[0].Rows.Add
                        (new object[]
                        {
                        dataGridView1[0,i].Value.ToString(),
                        dataGridView1[1,i].Value.ToString(),
                        dataGridView1[2,i].Value.ToString(),
                        dataGridView1[3,i].Value.ToString(),
                        dataGridView1[4,i].Value.ToString(),
                        dataGridView1[5,i].Value.ToString(),
                        dataGridView1[6,i].Value.ToString(),
                        dataGridView1[7,i].Value.ToString(),
                        dataGridView1[8,i].Value.ToString(),
                        dataGridView1[9,i].Value.ToString(),

                         });
                }
                form2 frm = new form2();
                ReportDocument crCR = new ReportDocument();
                crCR.Load("D:\\Personal\\MMS\\testCR\\testCR\\PurRep.rpt");
                crCR.SetDataSource(ds);
                frm.crystalReportViewer1.ReportSource = crCR;
                frm.crystalReportViewer1.Refresh();
                frm.Show();
            }

Please help me as soon as posible.

2
Contributors
2
Replies
17
Views
1 Year
Discussion Span
Last Post by rproffitt
0

Who is Frien? Anyhow it appears you are posting widely. But searching seems to find a tutorial. So moving on.
http://www.c-sharpcorner.com/forums/transfer-data-from-dgv-of-form1-to-crystal-report-of-form2
https://www.youtube.com/watch?v=7J_zpg1Xo0A shows passing data from grid to another form.
https://www.codeproject.com/Answers/758276/How-transfer-data-datagridview-to-crystal-report-i#answer1 notes how to get data into CR without a database.

You have a lot of stuff to read, and more work ahead of you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.