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!

Passing a parameter value to Crystal from VB.NET 2

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
US
Does anyone know how to pass a value to a parameter in Crystal from VB.NET? There seems to be all sorts of discrete parameters, ranges, and multiple default values.

All I want to do is say:

Parameter1 = 5

Thanks for the help!
 
Use the Report objects, ParameterFieldDefinitions collection to manipulate the parameters. As with formulas, there is one ParameterFieldDefinition object in the collection for each parameter field defined in the report. And like formulas, the proper memeber of the collection is retrieved with a one-based index determined by the order in which the parameter fields were added to the report

(IF you were to use) The RDC (Report Designer Component) approach for setting the value of a parameter field being passed to a report is to use the ParameterFieldDefinition object's AddCurrentValue method. This passes a single value to the report parameter field. Crystal Reports 8.5 allows multiple-value parameter fields, so you can execute the AddCurrentValue method as many times as necessary. (for example, in a loop that looks though a list box for selected items) to populate a parameter field with several values.

Using the VB interface enter the following code:

'Set parameter value
Report.Parametefields(1).AddCurrentValue (5)
End

Sorry if this is longwinded, I was trying to educate myself as well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top