Doesnt Chage Value
Dear All,
Hi, I want to set a parameter to my field with name "txtBarcode" in the .frx document that I was created.
I load it as carefully, after that, call the SetParameterValue function and set a value like this:
rpt.SetParameterValue("txtBarcode","test123");
Then I call Show function but the design view doesnt have my change and show the default parameter...
My code is like this:
FastReport.Report rpt = new Report();
rpt.Load("Label.frx");
rpt.SetParameterValue("Barcode1",textBox1.Text);
rpt.Parameters[0].Value = "asd";
rpt.Show();
Thanks for our helps, [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Best Regards.[/img]
Hi, I want to set a parameter to my field with name "txtBarcode" in the .frx document that I was created.
I load it as carefully, after that, call the SetParameterValue function and set a value like this:
rpt.SetParameterValue("txtBarcode","test123");
Then I call Show function but the design view doesnt have my change and show the default parameter...
My code is like this:
FastReport.Report rpt = new Report();
rpt.Load("Label.frx");
rpt.SetParameterValue("Barcode1",textBox1.Text);
rpt.Parameters[0].Value = "asd";
rpt.Show();
Thanks for our helps, [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Best Regards.[/img]
Comments
To print a parameter's value in the Text object, put the following text in it:
[Barcode1]
This code will set the parameter value and run a report:
FastReport.Report rpt = new Report();
rpt.Load("Label.frx");
rpt.SetParameterValue("Barcode1",textBox1.Text);
rpt.Show();
Thanks for your help, But it doesnt work too. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I create a text object (Name:"Barcode1", Text:"[Barcode1]") and my code: FastReport.Report rpt = new FastReport.Report(); rpt.Load("TestLabel.frx"); rpt.SetParameterValue("Barcode1", txtBarcode.Text); rpt.Show(); Thanks for following. Best Regards,[/img]
a text object (Name:"Text1", Text:"[Barcode1]")
a code to set the param value:
FastReport.Report rpt = new Report();
rpt.Load("Label.frx");
rpt.SetParameterValue("Barcode1",textBox1.Text);
rpt.Show();
or, another way to change the text object directly:
FastReport.Report rpt = new Report();
rpt.Load("Label.frx");
(rpt.FindObject("Text1") as TextObject).Text = textBox1.Text;
rpt.Show();
Also read about report parameters here:
http://www.fast-report.com/documentation/U...tparameters.htm
Thanks for your answer. The problem has been solved.
FastReport is really awsome