title: ReportViewer - Programmatically generate report
body: <p>I am trying to use the built-in Report Viewer control to generate my custom reports. Crystal Reports is heavy and doesn't work on all client computers therefore I'm giving the microsoft report build a try.</p>
  
  <p>The goal of this report is to print a list of all programs. They aregotten from the database and stored in a list like so:</p>
  
  <pre><code>Private Function ProgramDataset() As DataSet
      Dim ds As DataSet = New DataSet("Programs")
      Dim allPrograms As List(Of clsProgram) = clsProgram.GetAll()
  
      'Build datatable
      Dim table1 As DataTable = New DataTable("Programs")
      table1.Columns.Add("ProgramName")
  
      For Each program As clsProgram In allPrograms
          table1.Rows.Add(program.Name)
      Next
  
      ' Create a DataSet. Put the table in it
      ds.Tables.Add(table1)
  
      Return ds
  End Function
  </code></pre>
  
  <p>So my dataset is called "Programs" and it contains a DataTable with a column named "ProgramName". I add the name of the program and finally return the dataset to be used here:</p>
  
  <pre><code>Dim ds As DataSet = ProgramDataset()
  Dim p As New ReportParameter("programName", "Test")
  frmReportViewer.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
  frmReportViewer.ReportViewer1.LocalReport.ReportPath = "..\..\Reports\rptReport.rdlc"
  frmReportViewer.ReportViewer1.LocalReport.SetParameters(p)
  frmReportViewer.ReportViewer1.LocalReport.DataSources.Clear()
  frmReportViewer.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("Programs", ds.Tables(0)))
  frmReportViewer.ReportViewer1.DocumentMapCollapsed = True
  frmReportViewer.ReportViewer1.RefreshReport()
  frmReportViewer.Show()
  </code></pre>
  
  <p>My report named "rptReport" contains a parameter field named "programName". Right now I write in "Test" and it works. My issue is, I want it to print out all program names through a loop but I'm not quite sure how to go about doing that...</p>