Dear NG,
I am learning more about Crystal Reports (CR) running under .NET. Please
find my latest code at the end of this post. Here are my issues:
First, and most important, is Crystal Reports (CR) the right tool for
printing reports? I have well over 100 reports in my application and I
would like to use the best tool for the job.
Second, if CR is the right tool, am I using it correctly? Because it was
easy to do, I started using CR directly against the SQL database. This
seems to be called the "Pull" technique by books on CR. For 90% of my
reports this will work. For the last 10% I will have to reformat and/or
restructure the data in a # program. At this point I could either create a
temporary SQL table and print the report use the same "Pull" technique I
have been using on the 90%, or send it to CR using the "Push" technique. I
have not yet learned the "Push" technique. A good example of such a report
in my ERP application would be an indented Bill of Materials report. This
is a report that follows a tree structure rather than a simple listing of
records (rows) in a table.
Third, moving the .Zoom(75) property to the end of the report made the
message that appears in the bottom of the window say 75%, but the view was
at 100%. I can use the icons at the top of the window to force it to 75%.
Other properties now set by code take effect correctly such as the
..DisplayGroupTree property.
crystalReportViewer1.DisplayGroupTree = false;
crystalReportViewer1.Zoom(75);
Finally, is the report load event the proper place for this code? I have a
feeling that this might NOT be the right place for this code. This is
because the default request for the parameter dialog box comes up BEFORE
this load event is entered!
As ever, thank you for your help,
Cheers,
Bob
--
Robert Schuldenfrei
S. I. Inc.
32 Ridley Road
Dedham, MA 02026
bo*@s-i-inc.com
781/329-4828
private void Form1303_Load(object sender, System.EventArgs e)
{
//Must pick up parameters first
Form planProd = new PlanProd();
planProd.ShowDialog();
//Use the viewer object to create plannerCode
rpt1303 myReport = new rpt1303();
//Step 1: assign report object to viewer
crystalReportViewer1.ReportSource = myReport;
//Step 2: reference parameterFields collection
parameterFields = crystalReportViewer1.ParameterFieldInfo;
//Step 3: reference the parameterField
parameterField = parameterFields["plannerCode"];
//Step 4: create a parameterValue object
parameterDiscreteValue = new ParameterDiscreteValue();
//Step 5: assign a value to the object from dialog box displayed first
parameterDiscreteValue.Value = PlanProd.globalPlannerCode;
//Step 6: add the parameterValue object to the CurrentValues collection
parameterField.CurrentValues.Add(parameterDiscrete Value);
//MessageBox.Show("Planner Code: " + PlanProd.globalPlannerCode, "Info");
crystalReportViewer1.DisplayGroupTree = false;
crystalReportViewer1.Zoom(75);
}