Public Class Form1 Private customersByCityReport As CustomerByCity Private Const PARAMETER_FIELD_NAME As String = "City"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ConfigureCrystalReports() End Sub
Private Sub ConfigureCrystalReports() Dim myArrayList As ArrayList = New ArrayList() myArrayList.Add("Paris") myArrayList.Add("Tokyo") SetCurrentValuesForParameterField(customersByCityReport, myArrayList) customersByCityReport = New CustomerByCity myCrystalReportViewer.ReportSource = customersByCityReport End Sub
Private Sub SetCurrentValuesForParameterField(ByVal myReportDocument As ReportDocument, ByVal myArrayList As ArrayList) Dim currentParameterValues As ParameterValues = New ParameterValues()
For Each submittedValue As Object In myArrayList Dim myParameterDiscreteValue As ParameterDiscreteValue = New ParameterDiscreteValue() myParameterDiscreteValue.Value = submittedValue.ToString() currentParameterValues.Add(myParameterDiscreteValue) Next Dim myParameterFieldDefinitions As ParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields Dim myParameterFieldDefinition As ParameterFieldDefinition = myParameterFieldDefinitions(PARAMETER_FIELD_NAME) myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues) End Sub
End Class
However, when I run the message the line in red causes the error message: object reference not set to instance of an object
I only use the parameter definition stuff when I'm scheduling a report that's in BusinessObjects and I'm dealing with a Report object instead of a ReportDocument object.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum