Hi All , In Form1 I've a CheckBox Control . I droped A CrystalReportViewer and ReportDocument in Form1. I want to take a Report to show all of the Records' specified field(for e.g. :"firstname") , when I checked the CheckBoxControl . I Wrote this in btnShowReport_Click:
string query = "select * from TestReport";
sqlconn.Open();
da = new SqlDataAdapter(query, sqlconn);
SqlCommandBuilder scb = new SqlCommandBuilder(da);
da.Fill(DS.TestReport);//DS is a DataSet object .
myCrystalReport1.SetDataSource(DS);
//-----------------
ParameterField paramfield = new ParameterField();
ParameterFields paramfields = new ParameterFields();
ParameterDiscreteValue discreteval = new ParameterDiscreteValue();
and I create a parameter in report :"myfirstname" and in Formula editor , I wrote this : local numberVar myNumber; if myNumber=10 then {TestReport.firstname} = {?myfirstname} Now , I want to say : 1 - how can i use this variable (myNumber) in Form1.cs . 2 - I want to be shown all of the record firstname field ,how can i do it in : discreteval.Value = ??????????????????? thanks for any help . Regards ,
atlast , It was solved in this way : at the first in report page , right click on every field that we want to show or not , then select format object and in Common tab , checked suppress checkbox . finally in Form1.cs and in btnShowReport_Click , write this : myCrystalReport1.ReportDefinition.Sections[2].ReportObjects["firstname1"].Obj ectFormat.EnableSuppress = false;