Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where does code go for passing parameters...

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
0
0
US
Hey all, I need to pass a parameter from VB.NET to my CR Report 10. After looking at some examples like this...

Code:
For passing parameter from TextBox to Crystal Report follow following steps

1)add Crystal report and viewer in your project
2)on which field u want to add parameter is let's examples "Name" Field.

3)First In report Create parameter by right click on parameter field--> Name
4)In pop up enter Name as -->paraName
5)Second In report clicked on Database field-->Table Name--> Field Name(Here "Name" )
6)Right clicked on Name field-->click on Select Exert
7)Is equal to --> parameter Name({?paraName})


Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields
       Dim param1Field As New CrystalDecisions.Shared.ParameterField
       Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue
       Dim CRYRpt1 As New CrystalReport1

       param1Field.ParameterFieldName = "paraName" ' Parameter Name In Crystal Report
       param1Range.Value = TextBox1.Text          ' value For Parameter Field
       param1Field.CurrentValues.Add(param1Range)
       param1Fileds.Add(param1Field)                   ' To add parameter in parameterslist
       CrystalReportViewer1.ParameterFieldInfo = param1Fileds 'to pass parameter inf.to CRV
       CrystalReportViewer1.ReportSource = CRYRpt1            ' Assign Report Source to CRV
       CrystalReportViewer1.Refresh()
       CrystalReportViewer1.Visible = True

End Sub

I have some questions. I put the crystal report viewer1 in a seperate form from where user's input the parameter. Soo what do I do about this code? Does some of this need to be in the other form, or what? I'm getting extremely confused on this, it doesnt seem easy at all.

I have the form working great, the report is ready, and the Stored Procedure that provides the source for the report... but I'm stuck on passing this parameter to vb.Net.
 
I am struggling with the same problem. If somebody replies to this post, could you please point me to the reference or provide a sample code on how to do it in c#?
Thanks,
Marina.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top