# How to customize parameters in crystal reports.



## toonworld (May 19, 2004)

Anyone know how to do this? All I can ever get is the default parameters screens which are really annoying because i can't seem to figure out how to customize them. Thank you.


----------



## toonworld (May 19, 2004)

To Modify Parameter Fields at Runtime
[Visual Basic] 
' Declare variables needed to pass the parameters
' to the viewer control.
Dim paramFields As New ParameterFields()
Dim paramField As New ParameterField()
Dim discreteVal As New ParameterDiscreteValue()
Dim rangeVal As New ParameterRangeValue()

' The first parameter is a discrete parameter with multiple values.

' Set the name of the parameter field, this must match a 
' parameter in the report.
paramField.ParameterFieldName = "Customer Name"

' Set the first discrete value and pass it to the parameter
discreteVal.Value = "AIC Childrens"
paramField.CurrentValues.Add(discreteVal)

' Set the second discrete value and pass it to the parameter.
' The discreteVal variable is set to new so the previous settings
' will not be overwritten.
discreteVal = New ParameterDiscreteValue()
discreteVal.Value = "Aruba Sport"
paramField.CurrentValues.Add(discreteVal)

' Add the parameter to the parameter fields collection.
paramFields.Add(paramField)

' The second parameter is a range value. The paramField variable
' is set to new so the previous settings will not be overwritten.
paramField = New ParameterField()

' Set the name of the parameter field, this must match a
' parameter in the report.
paramField.ParameterFieldName = "Customer ID"

' Set the start and end values of the range and pass it to the 'parameter.
rangeVal.StartValue = 42
rangeVal.EndValue = 72
paramField.CurrentValues.Add(rangeVal)

' Add the second parameter to the parameter fields collection.
paramFields.Add(paramField)

' Set the parameter fields collection into the viewer control.
crystalReportViewer1.ParameterFieldInfo = paramFields

crystalReportViewer1.ReportSource = "c:\reports\my report.rpt"

---------------------------------------------------------------

I found this in the help files of microsoft vb.net.
Okay after a lot of time i got that to work. But I have 3 different parameters and can't seem to get the report to work with 3. I got it to work with 1 parameter but not with more than one. I'm looking for a class, semester, and section number that are in combo boxes on a windows form in vb.net. If anyone knows please respond i've looked all over the internet for answers.


----------



## petermeylor (Jun 11, 2005)

I saw a related article long back at codesforall.com. see if that's of any help to you.


----------

