How to use Crystal Reports in your projects
It was a problem finding how we to print reports using Crystal Reports, but I will tell you how. Visual Studio .NET supports Crystal Reports and you can use it easily from there.
- Create a new C# .NET or VB.NET Windows Application project.
- With the .NET toolbox, design your project as in this figure:
- You need a
Button, and a
CrystalReportViewer object in your project.
- Be sure that your SQL Server connection is started, then connect to your SQL Server and use the PUBS tables in your project.
- Now generate your dataset object.
- Right click on your project name in Solution Explorer and choose Add New Item, as in this figure:
- Now find the Crystal Report item and add it to your project.
- After you do that, you must configure your report.
- In the standard report creation wizard, select your dataset in the Project Data option. Select the AUTHORS table and add it to the selected table part.
- In the next step, select the fields you want to print and add it to the right part and click on the Finish button.
- Form your Toolbox, choose the Report Document object from the Component part and apply its setting.
- You are ready for coding your project. For the Click event of the button, write this code:
crystalReportViewer1.ReportSource = crystalReport11;
That's all. That was really easy!!
I am not using Microsoft.NET and Crystal report anymore.
I moved from computer science to space science in 2008. Currently I'm a researcher in space plasma physics in Sweden. I apologize if I cannot reply your emails/messages anymore. This is because I am not using Windows and any of the Microsoft products.