This is a migrated thread and some comments may be shown as answers.

Setting Report at Runtime

1 Answer 11 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Luke
Top achievements
Rank 1
Veteran
Luke asked on 16 May 2020, 10:12 PM

Good Evening All,

 

Hope you are keeping well in the current climate.

I have a form with a report viewer on that am i am trying to set the report that viewer will display at runtime.  I have the following code to do this.

 

Dim ReportViewer As New FrmReportViewer
Dim NotificationReport As New rptNotificationPrintOut
Dim strCommand As String = "SELECT tblNotifications.URN, tblNotifications.Sender, tblNotifications.Reciever, tblNotifications.Date_Sent, " &
"tblNotifications.Time_Sent, tblNotifications.Title, tblNotifications.Details, tblNotifications.Notification_Type, tblusernotifications.status " &
"FROM tblNotifications INNER JOIN tblUserNotifications On tblNotifications.URN = tblUserNotifications.Notification_ID WHERE " &
"tblUserNotifications.User_ID = '" & strUserID & "'"
 
Dim sqlReportDataSource As New SqlDataSource(strCommand, strConnectionString)
NotificationReport.DataSource = sqlReportDataSource
 
Dim DisplayReport As New InstanceReportSource
DisplayReport.ReportDocument = NotificationReport
ReportViewer.ReportViewer1.ReportSource = DisplayReport
 
ReportViewer.Show()

 

This code is displaying the report viewer form however it is not loading and displaying the report.

Thanks in advanced for the assistance

Frosty

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 20 May 2020, 02:26 PM

Hi Frosty,

Test to call the RefreshReport() method of the viewer:

ReportViewer.ReportViewer1.RefreshReport()

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Luke
Top achievements
Rank 1
Veteran
Answers by
Todor
Telerik team
Share this question
or