PDA

Click to See Complete Forum and Search --> : [RESOLVED] passing value to crystal report


popskie
Jul 29th, 2005, 07:47 PM
hi,
How to pass value to crystal report text object?

ex. form1.label1.text pass to crystal text object.

popskie

fret
Jul 29th, 2005, 08:55 PM
not totally familiar with crystal reports, mostly this is what i did. In the crystal report i used the parameter fields in order to hold values coming from my form, so this would be.


ParameterDiscreteValue pd = new ParameterDiscreteValue();
ParameterValues pv = new ParameterValues();

private void button1_Click_1(object sender, System.EventArgs e)
{
CrystalReport1 cr = new CrystalReport1();
pd.Value = this.textBox1.Text;
pv.Add(pd);
cr.DataDefinition.ParameterFields["name"].ApplyCurrentValues(pv); // "name" is the parameter set in my crystal report
crystalReportViewer1.ReportSource = cr; // report viewer
}


hope that helps. :bigyello:

popskie
Jul 29th, 2005, 09:46 PM
My crystal report has no table involve. Just only a textbox but what I want during runtime my form pass the value to report textbox.

fret
Jul 29th, 2005, 09:54 PM
then you should put a parameter fields in you crystal report and that code above. :bigyello:

fret
Jul 29th, 2005, 10:00 PM
here....

popskie
Jul 29th, 2005, 10:13 PM
ok fret, how to show the field explorer .

fret
Jul 29th, 2005, 10:38 PM
it is already there in your crystal report design.

popskie
Jul 29th, 2005, 10:45 PM
It is invisible in my c# app. but in crystal report designer its ok.

popskie

fret
Jul 29th, 2005, 10:56 PM
It is invisible in my c# app. but in crystal report designer its ok.

popskie

what do you mean by that? i don't quitely get it? could you explain it more, because i actually what i did, in my c# app i add a new item>>crystal report, just that, you'll only see the field explorer in the crytal report itself. :)

popskie
Jul 29th, 2005, 11:04 PM
pls take alook the attach doc file.

popskie

fret
Jul 29th, 2005, 11:13 PM
i see....ehehe there's no "field explorer" :bigyello: try press Ctrl+Alt+T.

popskie
Jul 30th, 2005, 12:03 AM
ok thanks a lot .