PDA

Click to See Complete Forum and Search --> : creating and accessing parameter fields on runtime


quietfulness
Jul 27th, 2004, 07:32 PM
Good day.

I now exploring how to create reports in crystal report.net. However, i have problem on creating parameter fields by run time.

I have searched some codes that I can use, and I have found one. The problem is that I cannot access the value of the parameter i just created?





Dim myparamfields As New ParameterFields
Dim myparamfield As New ParameterField
Dim mydiscretevalue As New ParameterDiscreteValue
Dim paramvalues As New ParameterValues


myparamfield.ParameterFieldName = "flavor"
mydiscretevalue.Value = "chocolate"
myparamfield.CurrentValues.Add(mydiscretevalue)

myparamfields.Add(myparamfield)

crviewer.ParameterFieldInfo = myparamfields

crviewer.reportsource = reportdocument
..



Then when i check the parameterfieldinfo of the cr report viewer, it has one parameter, but i cant access the value of the parameter. I tried it using:

crviewer.parameterfieldinfo("flavor").currentvalues.item(0)

Is it the right code?

If not , could anyone please help me how to get the value of the parameter i just created. And how can I position the parameter i just created to a specific position in the report.


Any advice would be of great help. Thank you very much