Filtering records and generating report in VB.Net


The program is written in Visual Studio 2010 for the front-end and MS SQL Server 2008 R2 for the back-end. The main purpose of this program is to filter records from report viewer control.

Instructions
  1. Run Microsoft SQL Server 2008 R2. 
  2. Locate and attach database named StudentMonitoring.mdf 
  3. Run ESSSample_Report.vbproj
Code snippet (filter by lname)



Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Me.ReportViewer1.RefreshReport()
        Dim ds As New ESSSample_Report.StudentMonitoringDataSet1
        Dim da As New ESSSample_Report.StudentMonitoringDataSet1TableAdapters.tblStudentTableAdapter
        da.Fill(ds.tblStudent)
        ds.tblStudent.DefaultView.RowFilter = "Lname like '" & Me.TextBox1.Text & "%'"
        tblStudentBindingSource.DataSource = ds.tblStudent.DefaultView
        Me.ReportViewer1.RefreshReport()
    End Sub

Click Here To Download Source Code