ljhodgett
asked on
show crystal report in crystal report viewer on c# 2005 winform
Hi,
I have created a crystal report that is linked to a dataset. I am trying to find out how I would show this in a c# crystal report viewer contained in a winform. The code I usually use in vb.net is: -
Dim rpt As New crUsage_By_Date
rpt.Load(Forms.Application .StartupPa th & "\crUsage_By_Date.rpt")
rpt.SetDataSource(DsReport s1.Tables( "Usage_By_ Date"))
rpt.SetParameterValue("Rep ort_Period ", DateTimePicker1.Text & " to " & DateTimePicker2.Text)
rpt.SetParameterValue("Pri nted_By", MDIParent1.lblUser.Text)
'frmPreviewReport.CrystalR eportViewe r1.ReportS ource = rpt
'frmPreviewReport.Show()
I am trying to find out the c# equivalent.
Many thanks
Lee
I have created a crystal report that is linked to a dataset. I am trying to find out how I would show this in a c# crystal report viewer contained in a winform. The code I usually use in vb.net is: -
Dim rpt As New crUsage_By_Date
rpt.Load(Forms.Application
rpt.SetDataSource(DsReport
rpt.SetParameterValue("Rep
rpt.SetParameterValue("Pri
'frmPreviewReport.CrystalR
'frmPreviewReport.Show()
I am trying to find out the c# equivalent.
Many thanks
Lee
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
I've put the following code into my form:-
CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument crReportDocument = new CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument();
String path = Environment.CurrentDirecto ry;
crReportDocument.Load(path + @"\crProgressReport.rpt");
crReportDocument.SetDataSo urce(myDSM easurement s.Tables[" dtMeasurem ents"]);
crystalReportViewer1.Repor tSource = crReportDocument;
but it comes up Load report failed on crReportDocument.Load(path + @"\crProgressReport.rpt"); the path variable seems to be correct and the rpt is contained within the directory. Unfortunately it doesn't give me any more information. What am I doing wrong please.
Many Thanks
Lee
I've put the following code into my form:-
CrystalDecisions.CrystalRe
String path = Environment.CurrentDirecto
crReportDocument.Load(path
crReportDocument.SetDataSo
crystalReportViewer1.Repor
but it comes up Load report failed on crReportDocument.Load(path
Many Thanks
Lee
What is the purpose of the @ in the Load statement?
mlmcc
mlmcc
waiting for your reply
ASKER
Hi,
For some reason it's not working on my development pc but it's ok on my laptop. I'm having quite a few issues with visual studio on my development pc so I think I need a fresh install.
Best regards
Lee
For some reason it's not working on my development pc but it's ok on my laptop. I'm having quite a few issues with visual studio on my development pc so I think I need a fresh install.
Best regards
Lee
try some msdn search