Microsoft Report Viewer 2008
How do I Filter a ReportViewer through a Form?
For example, I would like to choose a Date from a Form and then use this Date to filter the Report Viewer in VB.NET 2008.
Public Class frmPatientsDetailsMasterReport
Dim sql As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnViewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewReport.Click
sql = "SELECT * FROM tblPatientEntry WHERE RegistrationDate BETWEEN '" & DateTimePicker1.Text & "' AND RegistrationDate '" & DateTimePicker2.Text & "'"
'TODO: This line of code loads data into the 'HospitalManagementSystemDataSet.tblPatientEntry' table. You can move, or remove it, as needed.
Me.tblPatientEntryTableAdapter.Fill(Me.HospitalManagementSystemDataSet.tblPatientEntry)
Me.ReportViewer1.RefreshReport()
End Sub
End Class