无法将bindingsource转换为datatable

时间:2016-11-06 23:05:55

标签: vb.net datagridview datatable crystal-reports

我有以下代码:

    Dim dt As New DataTable
        dt = CType(Me.DataGridView1.DataSource, DataTable)

        Dim cr As New Reporte_cotiza
        cr.SetDataSource(dt)

        Dim imprime As New Reporte
        imprime.CrystalReportViewer1.ReportSource = cr
        imprime.ShowDialog()
    Catch ex As Exception
        MessageBox.Show(ex.Message.ToString)
    End Try

我想使用Crystal Reports打印datagridview的内容。但是,当我按下我的"打印"按钮我收到错误:

  

无法转换类型" System.Windows.Forms.BindingSource"的对象输入" System.Data.DataTable"

我将不胜感激任何帮助

0 个答案:

没有答案