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"



Quote Originally Posted by kleinma View Post
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.