locked
VB.net Crystal Report Viewer is blank

    Question

  • Hi everyone!

    I have VS 2008 SP1 and i have Crystal Reports installed.

    I have a single form with a Crystal Report Viewer, I created a report with the wizard, and i want to show it in the report viewer, but it keeps showing blank. The DB is a MDB, and the code i have in the form that loads the data is the following:

      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim conn As New OleDb.OleDbConnection
        conn = New OleDb.OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=|DataDirectory|\Scilla10.accdb")
        Dim Strcmdsel As String = "SELECT * from Muestras"
        Dim cmd As New OleDb.OleDbCommand(Strcmdsel, conn)
        Dim da As New OleDb.OleDbDataAdapter(cmd)
        Dim ds As DataSet = New DataSet("Muestras")
        Dim rptdocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        da = New OleDb.OleDbDataAdapter(Strcmdsel, conn)
        da.Fill(ds)
        Dim strReportPath As String = "CrystalReport1.rpt"
    
        rptdocument.Load(strReportPath)
        rptdocument.Refresh()
        rptdocument.SetDataSource(ds.Tables(0))
        CrystalReportViewer1.ReportSource = (rptdocument)
        CrystalReportViewer1.ShowRefreshButton = True
        CrystalReportViewer1.ShowRefreshButton = False
        CrystalReportViewer1.ShowPrintButton = True
        CrystalReportViewer1.Zoom(90)
        CrystalReportViewer1.DisplayGroupTree = False
      End Sub
    

    That is the entire project, nothing else, im sure its something silly i missed. Any ideas?

    Thank you!

    • Moved by Helen Zhou Thursday, September 23, 2010 1:47 AM (From:Windows Forms Data Controls and Databinding)
    Thursday, September 23, 2010 12:19 AM

All replies