Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone tel me how to print my crystal report which is on the crystalreportviewer,By command (mybutton)
Posted
Comments
tkkf87 15-Nov-12 1:14am    
MyReport.PrintToPrinter(1,False,0,0)

doesnt work for me

1 solution

Here is the code i've written this inside the page load event of crystal Report viewer

public DataTable dt = new DataTable();
private void crystalReportViewer1_Load(object sender, EventArgs e)
{
    Reports.CrystalReport crt = new Reports.CrystalReport ();
    crt.Database.Tables[0].SetDataSource(dt);
    crystalReportViewer1.ReportSource = crt;
}

in that datatable i've stored the value which i want to print.

Hope it helps you.
 
Share this answer
 
Comments
tkkf87 15-Nov-12 4:55am    
thx for helping me,
I need to print report that is already loaded to report viewer.
I have new button on the report viewer toolbar,once click that button i need to update my database as well as print that report as normal
sahabiswarup 15-Nov-12 5:22am    
then you have to write the above code in your new button click event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900