It was a problem to know how we can print our reports, but I tell you how.
Studio .NET support crystal report and you can use it easily.
Follow Me:
1. Create a new C#.NET or VB.NET windows application project.
2. With using .NET toolbox, design your project as such as this figure
3. You need a TextBox, a Button and a CrystalReportViewer objects in your project.
4. Be sure that your SQL Server connection is started, then connect to your SQL Server and use PUBS tables in your project. (If you have don't know how, I told you in my another article named "All you want in ADO.NET")
5. Now generate your dataset object.
6. Right click in your project name in the solution explorer and choose Add New Item, such as this figure.
7. Now find crystal report item and add it to your project.
8. After you do that, you must configure your report.
9. In the standard report creation wizard, select your dataset in the Project Data option. Select AUTHORS table and add it to selected table part.
10. In the next step, select the fields you want to print and add it to the right part and click at the FINISH button.
11. Form your TOOLBOX; choose the Report Document object from the Component part and apply its setting.
12. You are ready for coding your project. For Click Event of the button write these codes:
//Filling dataset with Authors table data.
dataAdapter.Fill(myDataSet.authors);
//Setting dataset tables to the crystal report document object.
crystalReport11.SetDataSource(myDataSet.authors);
//Telling to the report viewer, what is my report document.
crystalReportViewer1.ReportSource = crystalReport11;
//Or you can directly send your report to the printer with this line.
//In this case , you don't need a ReportViewer in your project.
/*crystalReport11.PrintToPrinter(1,true,0,1);*/
THAT IS TOO EASY!!
1 comments:
tnx. dajgui blog bn shoo. medlegeesee huvaaltssand bayarlalaa.
www.gegeen.com
Post a Comment