I have a reportviewer control on my program. It has been working and then I changed somethings that had nothing to do with it. I have this code else where in my program the only difference between this code and the other is the datasets. However, this one is not filling the data in the reportviewer. The data is in the datatable but it is not displaying on the report. Any ideas?
Here is my code:
'Shows Appropriate Batch Reports
Private Sub btnShowBatchReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowBatchReport.Click
Try
'Get Dates for reports
Dim todayDate As Date = Today
Dim weekDate As Date = Today.AddDays(-7)
Dim monthDate As Date = Today.AddMonths(-1)
Dim yearDate As Date = Today.AddYears(-1)
Dim name As String = My.Settings.Store_Name
'Assigning the report name object
Dim BatchReportName As New Generic.List(Of ReportParameter)
If rbBatchAll.Checked Then
Me.OVERALLINVENTORYTableAdapter.Fill(Me.POSDataSet.OVERALLINVENTORY)
BatchReportName.Add(New ReportParameter("ReportBatchName", "All Batches"))
ElseIf rbBatchMonth.Checked Then
Me.OVERALLINVENTORYTableAdapter.FillByBetweenDates(Me.POSDataSet.OVERALLINVENTORY, monthDate, todayDate)
BatchReportName.Add(New ReportParameter("ReportBatchName", "Past Month Batches " & monthDate & " to " & todayDate))
ElseIf rbBatchWeek.Checked Then
Me.OVERALLINVENTORYTableAdapter.FillByBetweenDates(Me.POSDataSet.OVERALLINVENTORY, weekDate, todayDate)
BatchReportName.Add(New ReportParameter("ReportBatchName", "Past Week Batches " & weekDate & " to " & todayDate))
ElseIf rbBatchYear.Checked Then
Me.OVERALLINVENTORYTableAdapter.FillByBetweenDates(Me.POSDataSet.OVERALLINVENTORY, yearDate, todayDate)
BatchReportName.Add(New ReportParameter("ReportBatchName", "Past Year Batches " & yearDate & " to " & todayDate))
Else
Me.OVERALLINVENTORYTableAdapter.FillByBetweenDates(Me.POSDataSet.OVERALLINVENTORY, dpBatchStartDate.Value, dpBatchEndDate.Value)
BatchReportName.Add(New ReportParameter("ReportBatchName", "Custom Batches between" & dpBatchStartDate.Value & " and " & dpBatchEndDate.Value))
End If
'Resets the Report Viewer
rvBatchOrders.Reset()
'Creates the ReportData Source Object
Dim BatchOrders = New Microsoft.Reporting.WinForms.ReportDataSource
'Assigns the DataSet to the object
BatchOrders.Name = "InventoryBatch"
'Assigns the binding source of the dataset
BatchOrders.Value = INVENTORYBindingSource
'Clears Previous Data source
Me.rvBatchOrders.LocalReport.DataSources.Clear()
'Add the new data source
Me.rvBatchOrders.LocalReport.DataSources.Add(BatchOrders)
'Embeds the new report in the report viewer
rvBatchOrders.LocalReport.ReportEmbeddedResource = "POS_System_V2.OrderBatches.rdlc"
'Sets the Report Name
rvBatchOrders.LocalReport.SetParameters(BatchReportName)
rvBatchOrders.SetDisplayMode(DisplayMode.PrintLayout)
rvBatchOrders.ZoomMode = ZoomMode.PageWidth
'Refreshs the report viewer with the new report
rvBatchOrders.Refresh()
rvBatchOrders.RefreshReport()