Skip to Content
0
Former Member
Mar 19, 2009 at 02:01 AM

Cannot pass new parameter to Crystal Viewer

26 Views

Hi All,

I have a listbox with multiple selection option. When I initially select a few options from the list, I can successfully pass those parameters to Crystal by clicking on a submit button. However, if I try and select other selections from the listbox and click submit, the new options don't pass to Crystal Viewer. The viewer just displays the original selection. Here is my code that I have:

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Web

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

display_report()

End Sub

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

display_report()

End Sub

Protected Sub display_report()

Dim parameterField As ParameterField

Dim report As New ReportDocument()

report.Load("C:\Report.rpt")

ParameterField = report.ParameterFields("Agent Group")

For Each li As ListItem In Me.ListBox1.Items

If li.Selected = True Then

' Add all parameters value here

ParameterField.CurrentValues.AddValue(li.Value)

End If

Next

CrystalReportViewer1.ReportSource = report

End Sub

End Class

I am missing some extra code to pass new parameters to the Viewer?

Thank you in advance.