title: How to fill a ReportViewer from a Datagridview VB.NET
body: <p>In other words, how to set the datasource of a <code>DataGridView</code> as the source of <code>ReportViewer</code>?</p>
  
  <p>I fill datagridview named as DGVData with the tables from SQL:</p>
  
  <pre><code>SqlCmd = New SqlCommand(Query, SQLCon)
  SQLDA = New SqlDataAdapter(SqlCmd)
  SQLDataset = New DataSet
  SQLDA.Fill(SQLDataset)
  Form2.DGVData.DataSource = SQLDataset.Tables(0)
  </code></pre>
  
  <p>Datagridview works good, but when I try to fill <code>ReportViewer</code> using the code below it returns an error.</p>
  
  <p><strong>"Unable to cast object of type 'System.Data.DataTable' to type 'Microsoft.Reporting.WinForms.ReportDataSource'."</strong></p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      MainReport.LocalReport.DataSources.Add(DGVData.DataSource)
      MainReport.LocalReport.Refresh()
  End Sub
  </code></pre>
  
  <p>Thank you in advance.</p>