Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PrintToPrinter cr c#.net 2003 ignores parameter fields..

Status
Not open for further replies.

DevMerl

Programmer
Jul 13, 2004
14
GB
Hi There Crystal Teckies....
Im having a battel with crystal once again..
I have some reports, which work finr in preview, however when trying to bulk print in the background, i am having a few issues.
Im using the crreport.PrintToPrinte method, which looks great, eacept that it is ignoring the report parameters i have set prior to calling PrinttoPrinter method, but they get totally ignored by crystal, and a blank report is printed.
Does anyone have the answer?
I have tried googling for a fair while, but have not been able to find anything.


try
{
this.Text = "Insurance for " + bookingref.ToString();
crReportDocumentInsurance = new Insurance(); // report = 0

crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = bookingref;

crParameterField = new ParameterField();
crParameterField.ParameterFieldName = "@BookingRef";
crParameterField.CurrentValues.Add(crParameterDiscreteValue);

crParameterFields = new ParameterFields();
crParameterFields.Add(crParameterField);

crvmain.ParameterFieldInfo = crParameterFields;
crvmain.ReportSource = crReportDocumentInsurance;
crvmain.Show();

if (print)
{
crReportDocumentInsurance.PrintOptions.PrinterName = printertouse;
crReportDocumentInsurance.PrintToPrinter(1,false,1,999);
this.Close();
}
else
{

}
}
catch (Exception ex)
{
MessageBox.Show(this,ReportError(ex.Message.ToString()));
}


Im trying.... will get there in the end......
 
Hurmph, Obviously two low or two high level a problem for this forum!


Im trying.... will get there in the end......
 
Er, ok, no wonder knowone replied.
Sorry i had not redone the parameters bit, expecting the crystal control to somehow work when printing.. silly me...
For those who get the same issue, use crReportDocument.SetParameterValue("param name",paramvalue);
when using the PrinttoPrinter functionality.
Its about a million times more straightforward than using the crreportcontrol anyhow.
Sorry for the wasted space.
Please delete this embarrasing post!!:)

Im trying.... will get there in the end......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top