|
-
Aug 12th, 2016, 12:39 PM
#1
Thread Starter
Junior Member
Re: RDLC Report With Two DataSets. How To ?
Dim dt As New DataTable
With dt
.Columns.Add("Column1")
.Columns.Add("Column2")
End With
For Each row As DataGridViewRow In GV2.Rows
dt.Rows.Add(row.Cells(2).Value, row.Cells(3).Value)
Next
Dim dt2 As New DataTable
With dt2
.Columns.Add("Column1")
.Columns.Add("Column2")
End With
For Each row As DataGridViewRow In GV4.Rows
dt2.Rows.Add(row.Cells(2).Value, row.Cells(3).Value)
Next
Report.ReportViewer1.LocalReport.DataSources.Item(0).Value = dt
Report.ReportViewer1.LocalReport.DataSources.Item(1).Value = dt2
But When I run the project it highlights me the last line and shows me this error
"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"
 Originally Posted by kleinma
If you set 2 data sources when designing the RDLC file, then when you set your datasource with valid data in this line of code
Report.ReportViewer1.LocalReport.DataSources.Item(0).Value = dt
you should also be setting the value of datasources.item(1).value, which would be the second datasource you had added.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|