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.StartupPath & "\crUsage_By_Date.rpt")
        rpt.SetDataSource(DsReports1.Tables("Usage_By_Date"))

        rpt.SetParameterValue("Report_Period", DateTimePicker1.Text & " to " & DateTimePicker2.Text)
        rpt.SetParameterValue("Printed_By", MDIParent1.lblUser.Text)
        'frmPreviewReport.CrystalReportViewer1.ReportSource = rpt
        'frmPreviewReport.Show()

I am trying to find out the c# equivalent.

Many thanks
Lee
ljhodgettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Smart_ManCommented:
usually it is quiet the same but for few brackets changed ,,
try some msdn search
0
mlmccCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ljhodgettAuthor Commented:
Hi,

I've put the following code into my form:-

            CrystalDecisions.CrystalReports.Engine.ReportDocument crReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            String path = Environment.CurrentDirectory;
            crReportDocument.Load(path + @"\crProgressReport.rpt");
            crReportDocument.SetDataSource(myDSMeasurements.Tables["dtMeasurements"]);
            crystalReportViewer1.ReportSource = 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
0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

mlmccCommented:
What is the purpose of the @ in the Load statement?

mlmcc
0
Smart_ManCommented:
waiting for your reply
0
ljhodgettAuthor Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.