Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey Guys , I am working in .Net Framework 3.5 WPF application and I want to generate report. So, I want to learn and use crystal reports but the problem is I can see the Crystal report viewer control in Windows Form project but not in Wpf Project. How should I integrate crystal report viewer in WPF Toolbox?
Posted

I suggest you start with googling "Crystal Report Viewer for WPF",

as it happens this link is to the results of that search:

Magic Google Results[^]

And this link is the top result:

http://www.c-sharpcorner.com/UploadFile/nipuntomar/crystal-report-viewer-in-wpf-part-1/[^]
 
Share this answer
 
Comments
RAHUL(10217975) 19-Sep-13 4:08am    
Hey Thanks Pheonyx...
I go through that website. Now i can see WPFviewer. As I am learning crystal reports following is my code
DataSet ds = new DataSet();
ReportDocument rd = new ReportDocument();
rd.Load(MyCrystalReportFilePath);
rd.SetDatabaseLogon("loginname", "password", "localhost", "DBNAme");
ds = LabelTemplates.GetTemplateDataset();
rd.SetDataSource(ds);
crystalReportsViewer1.ViewerCore.ReportSource = rd;
Last line its giving me error of "Object null reference" I dont know why its coming I have populated the report document. As you said I did lot of google for this but i didnt get the solution.If you know about this please let me know ...
Pheonyx 23-Sep-13 17:07pm    
Hi
Sorry I haven't responded sooner I have been away for 5 days. Have you stepped through your code and identified which object is null? Just before the last line executes you need to have a look at the various objects to identify why it is null and then google how to set that object.
The issue is resolved I was initializing crystalreportviewer control in the class constructor.Since that contraol was not loaded it was throwing me error. After that I initialize the control in form load . it was working fine.Thanks for your support.
 
Share this answer
 

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