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
Catch ex As Exception
LogIt(System.Reflection.MethodBase.GetCurrentMethod.Name.ToString & vbCrLf & " ERROR: " & ex.Message.ToString)
MsgBox(ex.ToString, , "Error with loading data. ")