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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.NET Parameters and Service Pack

Status
Not open for further replies.

jambu

Programmer
Nov 20, 2002
185
GB
Does anyone out there have "Working" code examples for using parameters from VB.NET? None of the examples I have seen, actually work.

I have just downloaded the service pack from crystaldecisions because they have a new way to set parameters - SetParameterValue - but I haven't figured out how to use this yet. Does anyone know?

Thanks in advance.
 
Here's some example code for you;

Dim myReport As New rptIMCover()
Dim paramFields As ParameterFields
Dim paramField As ParameterField
Dim discreteValue As ParameterDiscreteValue

paramFields = New ParameterFields()

paramField = New ParameterField()
discreteValue = New ParameterDiscreteValue()
paramField.ParameterFieldName = "Samples"

discreteValue.Value = Samples
paramField.CurrentValues.Add(discreteValue)
paramFields.Add(paramField)

CrystalReportViewer1.ParameterFieldInfo = paramFields

CrystalReportViewer1.ReportSource = myReport
CrystalReportViewer1.Refresh()

You obviously have to create your paramter field in your report with the correct name - Samples in this Case

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top