Click here to Skip to main content
15,901,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a small back end application, in which a main form load runs and all the other forms are child forms.
So, I have a form in which I display Orders in a DataGridView depending on users creteria selection dates. When the user chooses between two DateTimePickers Years or months interval I display a Bar Chart for SalesPrices and Years or months and when the user chooses days I display a Line Chart for SalesPrices. So I have created a crystal report for it and I was thinking to load the appropriate chart to a subreport depending on the user selection DateTime creteria. Is there a way to add a subreport to the main crystal report programmatically with source code and if yes how can I do that?
Thank you so much in advanced.

What I have tried:

C#
DataSet ds = new DataSet();
ds = FillMainSQLAdapterWithParameters();
DataSet prodDs = ChartFillAdapterWithParameters();

cr.SetDataSource(ds);
cr.Subreports[0].SetDataSource(prodDs);

FrstReportSource = cr;
                        
this.crystalReportViewer1.ReportSource = FrstReportSource;
this.crystalReportViewer1.EnableDrillDown = false;
this.crystalReportViewer1.Refresh();
Posted
Updated 9-May-24 4:56am
v2
Comments
Aggeliki Asimakopoulou 13-May-24 2:16am    
Thank you, I refered programmatically with source code in case it is possible of course, not manually!

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