Hello,
Please could someone help me on this. I have a button on which when clicked will display the crystal report. This report displays as required but when I want to view the report the second time, there's this error message: "Index 0 is out of range, Parameter name:index". FYI - The user just selects the date from the DateTime Picker control and clicks the OK button and the report should be display. The report is generated from a view in SQL Server 2008 Database. The code behind the OK button is:
Private Sub btnOK1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK1.Click
'Summary of calls for any given date.
'Dim objReport As New DALReport
Try
Dim cr As New rptCallSummaryGivenDate
Dim frm As New frmReporting1
Dim str As String
str = CType(dtpSpecificDateCalls.Text, Date).ToString("yyyy-MM-dd")
'Parameter to call the report
objReport.LaodCallSummaryReport(str)
'Cheeck whether the data exists for this date for reporting
If objReport.dss.Tables("vw_CallTally").Rows.Count > 0 Then
cr.SetDataSource(objReport.dss.Tables("vw_CallTally"))
'For the report form
frm.SDCR_CrystalReportViewer.ReportSource = cr
frm.MdiParent = Me.MdiParent
frm.Text = "Call Summary for " & str
frm.MaximizeBox = True
frm.WindowState = FormWindowState.Maximized
frm.Show()
Else
If MessageBox.Show("There's no data available associated with this date for reporting", "No Data", MessageBoxButtons.OK, MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK Then
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub