-
Jun 21st, 2017, 09:14 AM
#1
Thread Starter
Addicted Member
ReportViewer does not auto refresh after chainging data
I have an application that goes an gets data from SQL then displays it in a local rdlc. Then close the print preview form and run the program again to get different data. The print preview comes up with the old data. Even though I have: PrintPreview.ReportViewer1.LocalReport.Refresh(). If I right click ont the print preview form and refresh or hit the refresh button then the data updates on the screen. this is my code
Dim RDS As New ReportDataSource("DataSet1", ds.Tables(0))
PrintPreview.ReportViewer1.ProcessingMode = ProcessingMode.Local
PrintPreview.ReportViewer1.LocalReport.DataSources.Clear()
PrintPreview.ReportViewer1.LocalReport.DataSources.Add(RDS)
PrintPreview.ReportViewer1.LocalReport.Refresh()
PrintPreview.ReportViewer1.PrinterSettings.Copies = 1
PrintPreview.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
PrintPreview.ReportViewer1.ShowRefreshButton = True
Dim p1 As New ReportParameter("p1", lookup)
PrintPreview.ReportViewer1.LocalReport.SetParameters(p1)
PrintPreview.ReportViewer1.LocalReport.Refresh()
PrintPreview.ShowDialog()
I think I can fix it by using below code after the ShowDialog but I am not sure of how to rebind the datasource.
PrintPreview.ReportViewer1.Reset()
PrintPreview.ReportViewer1.LocalReport.DataSources.Clear()
PrintPreview.ReportViewer1.LocalReport.ReportPath = "History Report.rdlc"
Dim bindingsource As BindingSource = New BindingSource()
Now where do I go? (VS 2013)
Any help is much appreciated.
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
|