Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I am new in c# and crystal Reports using Vs2008

I have multiple grideview on one forms and I want print all grideview data on a single form on crystal reports.

like

Heading 1 from grideview 1
AAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCc

heading 2 from grideview 2
1111111111111111111111
2222222222222222
3333333333333

heading 3 from grideview 3
1111111111111111111111
2222222222222222
3333333333333
Posted

1 solution

1) convert your data From dataGridview to dataTable or DataSet

C#
DataTable dt = (DataTable)dataGridView1.DataSource;


2) pass it dataTable to Report Source

C#
DataTable dt = (DataTable)dataGridView1.DataSource;
 if( dt != null)
 {
 if( dt.Rows.Count > 0)
 {
 DataSet Ds = new DataSet();
 ds.Tables.Add(dt);
 objRpt.SetDataSource(Ds);
 }
 }
 
Share this answer
 
v2
Comments
Member 10841311 25-May-14 8:39am    
Thanks
but I am new so please explained code on forms with event or code on crystal code. Means code where forms have grideview or code where forms have show reports.

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