g_johnson
asked on
Crystal Report Viewer in C# VS 2008, passing formulae
My application has a form called frmReport which contains a crystal report viewer object called crvMain. That form has no methods.
The application also has a form called Form1 and it contains some input fields and a button called "ShowReport"
When the user clicks "Show Report", this code is invoked:
frmReport f = new frmReport();
f.crvMain.ReportSource = this._CRPath;
f.crvMain.SelectionFormula = CrystalSelect;
f.ShowDialog();
this._CRPath is the actual network path to the Crystal Report being called. CrystalSelect is a string containing a list of order numbers to be used as the seleciton criteria in the Crystal report.
This works fine, and the report shows the correct information.
However, the report has a formula called "ReportUser" and I now need to fill that from this code with Environment.UserName.
How can I do that? If I can't do that, is there some other method short of a table write/read to accomplish this?
Thanks in advance for your help.
The application also has a form called Form1 and it contains some input fields and a button called "ShowReport"
When the user clicks "Show Report", this code is invoked:
frmReport f = new frmReport();
f.crvMain.ReportSource = this._CRPath;
f.crvMain.SelectionFormula
f.ShowDialog();
this._CRPath is the actual network path to the Crystal Report being called. CrystalSelect is a string containing a list of order numbers to be used as the seleciton criteria in the Crystal report.
This works fine, and the report shows the correct information.
However, the report has a formula called "ReportUser" and I now need to fill that from this code with Environment.UserName.
How can I do that? If I can't do that, is there some other method short of a table write/read to accomplish this?
Thanks in advance for your help.
ASKER
I'm sorry, but I'm not getting this. "f" in my code is a form, so f.SetParameterValue is not a valid method. I also can't find that method on f.crvMain (the viewer).
I cannot find a property for EnableParamterPrompt on the viewer either.
I cannot find a property for EnableParamterPrompt on the viewer either.
Do you have a report object?
mlmcc
mlmcc
ASKER
No, my code is exactly as shown above. I just have a form with a viewer on it. I set the viewer's ReportSource to the path of an existing Crystal report, set the selection formula for the viewer, and show the form.
I guess I don't know how to do this with a report object.
I guess I don't know how to do this with a report object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
f.SetParameterValue("Repor
CrystalReportViewer1.Enabl