changing MS ReportViewer's datasource and report source at runtime in Visual Studio 2008

I'm needing to change a ReportViewer's datasource and the report that goes along with it at runtime - a user clicks a button for the report they want and it will be loaded into the report viewer.
The attached code, however, only works the first time,  if another button is clicked to load another report (with it's corresponding dataset), an error is displayed.
"A data source instance has not been supplied for the data source ...."
Only the first report clicked loads.

Any way to do this?
Private Sub btnOAReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOAReport.Click
        EnableOAReport()
    End Sub
    Private Sub EnableOAReport()
        Me.ReportViewer1.LocalReport.DataSources.Clear()
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsOAReport_OrderProcHeaders", Me.DsOAReportBindingSource))
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOA.rdlc"
        Me.ReportViewer1.RefreshReport()
    End Sub
 
    Private Sub btnOCReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOCReport.Click
        EnableOCReport()
    End Sub
    Private Sub EnableOCReport()
        Me.ReportViewer1.LocalReport.DataSources.Clear()
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsOCReport_OrderProcHeaders", Me.DsOCReportBindingSource))
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOC.rdlc"
        Me.ReportViewer1.RefreshReport()
    End Sub
 
    Private Sub btnORReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnORReport.Click
        EnableORReport()
    End Sub
    Private Sub EnableORReport()
        Me.ReportViewer1.LocalReport.DataSources.Clear()
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsORReport_OrderProcHeaders", Me.DsORReportBindingSource))
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOR.rdlc"
        Me.ReportViewer1.RefreshReport()
    End Sub

Open in new window

bd9000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bd9000Author Commented:
Found the answer after trying every method for the ReportViewer instance.
ReportViewer1.Reset  did the trick.

I guess that makes me the resident EE ReportViewer expert now :)

    Private Sub btnOAReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOAReport.Click
        EnableOAReport()
    End Sub
    Private Sub EnableOAReport()
        Me.OrderProcHeadersTableAdapter1.Fill(Me.DsOAReport.OrderProcHeaders, StrToInt(OrderProc_idxTextBox.Text.Trim))
        Me.DsOAReportBindingSource.DataSource = Me.DsOAReport
        Me.ReportViewer1.Reset()
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOA.rdlc"
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsOAReport_OrderProcHeaders", Me.DsOAReportBindingSource))
        Me.ReportViewer1.RefreshReport()
    End Sub
 
    Private Sub btnOCReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOCReport.Click
        EnableOCReport()
    End Sub
    Private Sub EnableOCReport()
        Me.OrderProcHeadersTableAdapter2.Fill(Me.dsOCReport.OrderProcHeaders, StrToInt(OrderProc_idxTextBox.Text.Trim))
        Me.DsOCReportBindingSource.DataSource = Me.dsOCReport
        Me.ReportViewer1.Reset()
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOC.rdlc"
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsOCReport_OrderProcHeaders", Me.DsOCReportBindingSource))
        Me.ReportViewer1.RefreshReport()
    End Sub
 
    Private Sub btnORReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnORReport.Click
        EnableORReport()
    End Sub
    Private Sub EnableORReport()
        Me.OrderProcHeadersTableAdapter3.Fill(Me.dsORReport.OrderProcHeaders, StrToInt(OrderProc_idxTextBox.Text.Trim))
        Me.DsORReportBindingSource.DataSource = Me.dsORReport
        Me.ReportViewer1.Reset()
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "OrderProc.ReportOR.rdlc"
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsORReport_OrderProcHeaders", Me.DsORReportBindingSource))
        Me.ReportViewer1.RefreshReport()
    End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.