Problem Pringing Reports in C#
Posted on 2006-04-26
I have developed an app in c#, in visual studio.net that prints out word documents from a folder on a network. This works fine.
I have now added a crystal report to it, developed in CR10.
I have added it using Project > Add Existing Item.
I then used the toolbox to add the component ReportDocument to the form.
I want to print the report out after the word documents without previewing the report in a viewer.
The code below has been generated for the report, I have used the line application_Form___Overnight_Print1.PrintToPrinter(1,true,1,1); to try and print it
this.Application_Form_Print1.FileName = "";
this.Application_Form_Print1.InitReport += new (System.EventHandlerthis.Application_Form_Print1_InitReport);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(600, 470);
this.Name = "Form1";
private void application_Form___Overnight_Print1_InitReport(object sender, System.EventArgs e)
I run the report, the word documents print as normal, but no reports are printed to the printer, and I do not receive any error messages.
I have developed the report off a SQL database in CR10 using an odbc connection. The database has a userid and password.
Am I getting nothing because I have not connected to the database and how would I do this or is it something else?
I would also like to specify the printer name to print the reports from and wandered how to do this, the printers are networked and are in the format WSI-01/prn001
Can anybody help with this?