title: Filter or Set Parameter programmatically on Report(rdlc)
body: <p>I created a report(not wizard) on VB2010, and I set the Datasource using Dataset programmatically, I want to add a filtering option to the report</p>
  
  <p><img src="https://i.stack.imgur.com/XwzWd.png" alt="Dataset"></p>
  
  <p><img src="https://i.stack.imgur.com/RMo6D.png" alt="Tablix Filter Properties"></p>
  
  <p><strong>ORIGINAL CODE:</strong>
  this code show all the data with no filtering</p>
  
  <pre><code>Dim rptDataSource As ReportDataSource
  
  
              With rptReportViewer.LocalReport
                  .ReportPath = "Reports\" &amp; strReport &amp; ".rdlc"
                  .DataSources.Clear()
              End With
  
              Select Case strReport
                  Case "rptProducts"
                      Dim ds As New dsProducts
                      Dim da As New dsProductsTableAdapters.ProductsTableAdapter
  
                      da.Fill(ds.Products)
  
                      '//use the same name as defined in the report Data Source Definition
                      rptDataSource = New ReportDataSource("ProductsDataSet", ds.Tables("Products"))
  
              End Select
  
              rptReportViewer.LocalReport.DataSources.Add(rptDataSource)
              rptReportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
              rptReportViewer.ZoomMode = ZoomMode.Percent
              rptReportViewer.RefreshReport()
  </code></pre>
  
  <p>I do some googling and I insert the some code</p>
  
  <p><strong>MODIFIED CODE</strong></p>
  
  <pre><code>        Dim rptDataSource As ReportDataSource
          **'this code inserted**
          Dim FilterBrand As New ReportParameter("FilterBrand", txtfilter.Text)
  
  
              With rptReportViewer.LocalReport
                  .ReportPath = "Reports\" &amp; strReport &amp; ".rdlc"
                  .DataSources.Clear()
              End With
  
              Select Case strReport
                  Case "rptProducts"
                      Dim ds As New dsProducts
                      Dim da As New dsProductsTableAdapters.ProductsTableAdapter
  
                      da.Fill(ds.Products)
  
                      '//use the same name as defined in the report Data Source Definition
                      rptDataSource = New ReportDataSource("ProductsDataSet", ds.Tables("Products"))
  
              End Select
  
              rptReportViewer.LocalReport.DataSources.Add(rptDataSource)
              **'this code inserted**
               rptReportViewer.LocalReport.SetParameters(New ReportParameter() {FilterBrand})
  rptReportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
              rptReportViewer.ZoomMode = ZoomMode.Percent
              rptReportViewer.RefreshReport()
  </code></pre>
  
  <p>The report says error occur during report processing, what is problem, how to i set the filtering programmatically?</p>
  
  <p>Thanks</p>