vb.netcrystal-reportscrystal-reports-8.5

Calling Crystal Report File


can you help me i have problem with vb.net language. I want to call crystal report but can't with the data format in gridview sent via crystalreport. with the following code:

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


        Dim reports As New bpkb_1

        reports.SetDataSource(ds.Tables(0))
        viewermurabahah.CrystalReportViewer1.ReportSource = reports
        viewermurabahah.ShowDialog()
        
end sub

can you give an example of how the code to call the crystal report file outside of the visual studio vb.net project file?


Solution

  • You can call the load method of the ReportDocument

    Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
    rpt.Load(<Path to your crystal report file>)
    rpt.SetDataSource(<your data table>)
    YouReportViewer.ReportSource = rpt