The Artima Developer Community
Sponsored Link •

C# Answers Forum
passing crystal report variable to Form ...

1 reply on 1 page. Most recent reply: Aug 18, 2006 3:49 AM by mostafa Hosseiny

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
mostafa Hosseiny

Posts: 2
Nickname: mostafa
Registered: Aug, 2006

passing crystal report variable to Form ... Posted: Aug 17, 2006 6:21 AM
Reply to this message Reply
Advertisement
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();


paramfield.Name = "myfirstname";

discreteval.Value = ???????????????????


paramfield.CurrentValues.Add(discreteval);

paramfields.Add(paramfield);

crystalReportViewer1.ParameterFieldInfo = paramfields;

//-----------------

crystalReportViewer1.ReportSource = myCrystalReport1;


crystalReportViewer1.Refresh();

sqlconn.Close();

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 ,


mostafa Hosseiny

Posts: 2
Nickname: mostafa
Registered: Aug, 2006

Re: passing crystal report variable to Form ... Posted: Aug 18, 2006 3:49 AM
Reply to this message Reply
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;

Flat View: This topic has 1 reply on 1 page
Topic: Scroll bar in .Net Previous Topic   Next Topic Topic: How to refresh main application UI when an external program is running?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use