This is the button that calls the report
Private
Sub btnQAChecklist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQAChecklist.Click
Dim rpt As New ReconChecklistRpt(_planToPlanUpload.PlanToPlanUploadId)
Dim frm As New PDRSReportViewer(rpt)
frm.Show()
End Sub
This is the code for the report.
Imports
System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
Imports System.Data.SqlClient
Partial Public Class ReconChecklistRpt
Inherits Telerik.Reporting.Report
Private _PlanToPlanUploadId As Integer
Public Sub New()
InitializeComponent()
_PlanToPlanUploadId = 5198
Me.DataSource = Nothing
End Sub
Public Sub New(ByVal PlanToPlanUploadId As Int32)
_PlanToPlanUploadId = PlanToPlanUploadId
Me.DataSource = Nothing
End Sub
Private Sub ReconChecklistRpt_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) HandlesMe.NeedDataSource
Dim cn As New SqlConnection(My.Settings.ConnectionString)
Dim da As New SqlDataAdapter("rpt_QACheckListByPlanToPlanUploadId", cn)
da.SelectCommand.CommandType = CommandType.StoredProcedure
da.SelectCommand.Parameters.AddWithValue(
"@PlanToPlanUploadId", _PlanToPlanUploadId)
Report.DataSource = da
End Sub
End
Class
This is the report viewer form
Public
Class PDRSReportViewer
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Public Sub New(ByVal report As Telerik.Reporting.IReportDocument)
InitializeComponent()
Me.ReportViewer.Report = report
End Sub
Private Sub PDRSReportViewer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.ReportViewer.RefreshReport()
End Sub
End
Class