Creating a reportviewer with multiple of same report sequentially
Hello,
I'm trying to load multiple results into a reportviewer. I'm having the user select multiple rows in a datagridview then click a button to load those into a reportviewer form. It works fine for a single event and associated sub table data. I envision having the reports sequentially page after page but I'd also be fine if it opened up multiple reportviewer forms ready for printing or saving. I'd have to limit the total number of openable events I suppose, otherwise a user could open hundreds and that would bog down or fail but that should be easy.
I played around with a query to capture all the events by serialno using an IN statement in the query builder for the dataset, but I kept getting an error and the reportviewer may not be able to handle it anyways so I thought I would ask before spending too much time on that.
Here's my attempted code that opens only the last selected event in the reportviewer:
Dim selectedRowCount As Integer = Form1.dgResults.Rows.GetRowCount(DataGridViewElementStates.Selected) Dim SerialNo As Integer = Nothing For i = 0 To selectedRowCount - 1 SerialNo = Form1.dgResults.SelectedRows(i).Cells("SerialNo").Value Debug.Print(RecordSerialNo) Try Me.IAdapter.Fill(Me.DataSet1.I, SerialNo) Me.pAdapter.Fill(Me.DataSet1.p, SerialNo) Me.vAdapter.Fill(Me.DataSet1.v, SerialNo) Me.cAdapter.Fill(Me.DataSet1.c, SerialNo) Me.uAdapter.Fill(Me.DataSet1.u, SerialNo) Catch ex As Exception LogIt(System.Reflection.MethodBase.GetCurrentMethod.Name.ToString & vbCrLf & " ERROR: " & ex.Message.ToString) MsgBox(ex.ToString, , "Error with loading data. ") End Try Next Me.ReportViewer1.RefreshReport()
Someone must have wanted to create a series of individual RDLC reports and either printed or saved them simultaneously. Perhaps looping through them and programmatically saving or printing as desired by the user? How to do this on an opened reportviewer?
mlmcc