+ Reply to Thread
Results 1 to 2 of 2

Thread: Crystal report doesnt work after i make the setup file

  1. #1
    c.vaibhav is offline VB.NET Forum Newbie c.vaibhav is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    May 2009
    Age
    24
    Posts
    22
    Reputation
    19

    Default Crystal report doesnt work after i make the setup file

    Hi folks,

    I am new to VB.NET.. I have made an application that makes use of crystal report.. I have used the following code..

    Code:
       Private Sub InvoicePrint_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            'InvoiceNumber = "000005"
            CrystalReportViewer1.ShowRefreshButton = False
            Me.CrystalReportViewer1.ShowGroupTreeButton = False
            CrystalReportViewer1.DisplayGroupTree = False
            Me.WindowState = FormWindowState.Maximized
    
            Dim ds As DataSet = New DataSet
            myConn = New SqlConnection(ConfigurationManager.ConnectionStrings("default").ToString)
            'Opening Connection
            myConn.Open()
    
            Dim sadapt As New SqlDataAdapter("Select * from dbo.InvoiceDatabase", myConn)
            sadapt.Fill(ds, "InvoiceDetails")
    
            'ds.WriteXml("D:\Test\InvoiceDetails.xsd")
    
            Dim strReportPath As String = Application.StartupPath
            Dim startstring
            startstring = InStr(strReportPath, "bin", CompareMethod.Text)
            strReportPath = strReportPath.Substring(0, startstring - 1)
            strReportPath = strReportPath & "Invoice.rpt"
            'strReportPath = "C:\Users\Vaibhav\Desktop\Windows Applications\Sorbe\Sorbe\CrystalReport1.rpt"
            If Not IO.File.Exists(strReportPath) Then
                Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
            End If
            Dim cr As New Invoice
    
            cr.Load(strReportPath)
            cr.SetDataSource(ds.Tables("InvoiceDetails"))
    
            CrystalReportViewer1.ReportSource = cr
            'Me.CrystalReportViewer1.Zoom(150)
    
            myConn.Close()
    
        End Sub
    I have given the startup path to open the crystal report.. but it doesnt work when I create a setup file.. I know that I am doing a wrong thing.. can anybody please provide a workaround..

    Regards,
    Vaibhav

  2. #2
    Bonny sol is offline VB.NET Forum Newbie Bonny sol is on a distinguished programming path ahead
    .NET Framework
    .NET 3.0 (VS 2005/2008)
    Join Date
    Oct 2009
    Age
    30
    Posts
    2
    Reputation
    0

    Default

    I got the same problem!

    I think that after you create the setup, the .RPT file still tries to get the data from the
    original file that you selected when you created the crystal report!

    The only problem is that I don't know how to fix this!

    I'm still looking for the answer, I'll post it when I've found it.

    Greetz

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts