0
votes

Hi i know this problem would be consider a duplicate since there's a lot of answered question regarding this kind of problem and i tried to try the possible correct code or answer about this kind of problem but it seem that i have no luck i decided to ask this question.

I have two parameters in crystal report the month and year I need to pass this coming from the vb.net to show the monthly report but after i run the report viewer it shows nothing but empty paper i wonder what's wrong about this and i think this code is correct but it's obviously not working i hope you help me thanks.

'Print stock out monthly report 
    Dim stockOutMonthlyPeriodReport As New StockOutMonthlyPeriodReport
    Dim stockOutMonthlyPeriodViewer As New StockOutMonthlyReportViewer

    Dim paramFields As New ParameterFields
    Dim param1Field, param2Field As New ParameterField
    Dim param1Range, param2Range As New ParameterDiscreteValue

        reportTimePeriodTextObject = stockOutMonthlyPeriodReport.Section1.ReportObjects("monthlyTextObject")
        reportTimePeriodTextObject.Text = "Monthly Report of " & monthlyReportComboBox.Text & " Year  " & monthlyYearReportComboBox.Text

        param1Field.ParameterFieldName = "timePeriodMonthName" ' Parameter Name In Crystal Report  param2Field.ParameterFieldName = "timePeriodYear" ' Parameter Name In Crystal Report
        param1Range.Value = monthlyReportComboBox.Text
        param1Field.CurrentValues.Add(param1Range)
        paramFields.Add(param1Field)

        param2Field.ParameterFieldName = "timePeriodYear" ' Parameter Name In Crystal Report
        param2Range.Value = yearlyReportComboBox.Text
        param2Field.CurrentValues.Add(param2Range)
        paramFields.Add(param2Field)

        stockOutMonthlyPeriodViewer.StockOutMonthlyCrystalViewer.ParameterFieldInfo = paramFields 'to pass parameter inf.to CRV
        stockOutMonthlyPeriodViewer.StockOutMonthlyCrystalViewer.ReportSource = stockOutMonthlyPeriodReport  ' Assign Report Source to CRV
        stockOutMonthlyPeriodViewer.Show()
1

1 Answers

0
votes

I set the parameters like this.

stockOutMonthlyPeriodReport.SetParameterValue("name of param", value)