Question Questions About Reports

B.P.

Member
Joined
Mar 19, 2011
Messages
7
Programming Experience
Beginner
I am a relatively new programmer and I am trying to use a simple report. I have added it through project> add new item> report> add, and I have set it up how I want it work. I do not, however, want to use a report viewer. I want the user to press a button and have the report print automatically. This is the code I tried:
Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
MyReport.Load("C:\Users\Ben\Documents\Visual Studio 2008\Projects\Key Club Project\Hour Sheet.rdlc")
If PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
MyReport.PrintOptions.PrinterName =
PrintDialog1.PrinterSettings.PrinterName
MyReport.PrintToPrinter(1, True, 0, 0)
End If
This returns a “load report failed” error. Can someone tell me where I went wrong?
Also I was wondering about how reports work when the project is compiled and distributed. Reports are included with the program, right? If so, then should I be using an absolute reference because the reference will change based on the computer it is installed on?
Any guidance will be appreciated,
BP
 
Is that a valid crystal report file? I thought they were ".rpt". Also, to answer the other questions your application should work if they have both the framework and crystal reports installed on their machine (the same version), and any other dependancies they may have. Hope that helps.
 
Back
Top