Link to home
Start Free TrialLog in
Avatar of zipnotic
zipnoticFlag for United States of America

asked on

Creating a reportviewer with multiple of same report sequentially


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
                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


Open in new window

Avatar of Mike McCracken
Mike McCracken

What reporting tool are you trying to use?

Avatar of zipnotic


Just an RDLC based on a dataset in a reportviewer form.  Winforms 2010 V.S.
I can't help you with that one, sorry


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?
I tried following this walkthrough with no luck:

and numerous pages that referenced this walkthrough.  Still getting errors on my datasets/tables when it comes time to render report.
Avatar of zipnotic
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial