.vb class file not created for crystal report in 2005

Posted on 2006-03-19
Last Modified: 2012-05-05
I am having problems figuring this out.  I am trying to do an automatic login in a crystal report using 2005.  From a previous post I got the code to do this.

The problem I seem to be having is that VS 2005 doesn't seem to be creating the .vb file under the .rpt report file.  Because of this I can create a new variable for the strongly instantiated report.  Example:

My report is called PalletLogReport.rpt
The page is called PalletLog.aspx
In the .vb code under the .aspx I have the following:

Dim crReportDocument As PalletLogReport()

The compiler then tells me that PalletLogReport is not defined.

What is happening here?  This is happening in VS 2005, does VS not create these files anymore in 2005?  

Question by:sbhegel
    LVL 100

    Expert Comment

    Did you build the dsr for the report?  To get the class, I believe you have to "import" the report into your application.

    LVL 8

    Expert Comment

    I am not sure about VS2005, but from VS2003, if I right click the .rpt file and click "Run Custom Tool", it will generate the .vb file for you.


    Author Comment


    What is the dsr?  And what do you mean by import?  I have made a copy of this file, deleted the original and then did and add existing item.  That still doesn't work.


    Author Comment


    I don't see a Run Custom Tool option when I right click the .rpt file.  Is there another way to access this?
    LVL 8

    Accepted Solution

    I am not sure about VS 2005, but in VS 2003 there is such option once I right click on the .rpt file.
    Other than implement the report using strongly instantiated, could you try other method such as

    Import CrystalDecision.ReportEngine
    Import CrystalDecision.Shared
    Dim crReport = new ReportDocument()
    crReport.Load("Your rpt...")

    It will be more flexible than using strongly instantiated, because you don't have to pre-generate a report class for each report.


    Author Comment


    I am totally confused now.  Here is the code I have in the web page that has the CR viewer in it.   This is in the Page_load procedure:

            Dim crReportDocument As New ReportDocument()        
            Dim crTableLogonInfos As TableLogOnInfos
            Dim crTableLogonInfo As TableLogOnInfo
            Dim crConnectionInfo As ConnectionInfo
            ' crReportDocument = New PalletLogReport()
            crTableLogonInfos = New TableLogOnInfos()
            crTableLogonInfo = New TableLogOnInfo()

            crConnectionInfo = New ConnectionInfo()
            With crConnectionInfo
                .ServerName = "myserver"
                .DatabaseName = "mydb"
                .UserID = "myuser"
                .Password = "mypassword"
            End With

            crTableLogonInfo.ConnectionInfo = crConnectionInfo
            crTableLogonInfo.TableName = "PalletLabel"

            CrystalReportViewer1.LogOnInfo = crTableLogonInfos
            CrystalReportViewer1.ReportSource = crReportDocument

    What is incorrect about this?

    Author Comment

    I figured this one out.  The reason the .vb file is not created for the .rpt file in VS 2005 is because:

    In Visual Studio 2005, Crystal Reports report files are no longer embedded in Web projects; therefore, no report wrapper class is generated. The reports are stored in a folder and, as with all non-embedded reports, they must be referenced by their file directory path. In this case, the directory path is to the current Web Site folder.

    However, Windows projects in Visual Studio 2005 remain unchanged from earlier Visual Studio versions; they continue to use embedded reports.

    Also the code I listed above didn't automatically login but the code below does:

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared

    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As Table
    Dim  crTableLogOnInfo As TableLogOnInfo
    Dim crConnectionInfo As ConnectionInfo

    CrConnectionInfo = New ConnectionInfo()
    With crConnectionInfo
          .DatabaseName = “database”
          .Password = “password”
          .ServerName = “servername”
          .UserID = “user id”
    End With

    CrDatabase = report.Database
    CrTables = crDatabase.Tables

    For Each crTable in crTables
          CrTableLogOnInfo = crTable.LogOnInfo
          CrTableLogOnInfo.ConnectionInfo = crConnectionInfo

    CrystalReportViewer1.ReportSource = report

    The difference is one was logging into the view and this code is passing the logon information to the report.

    I don't know the best way to give out the points on this, so if the moderator could lend there knowledge, I would appreciate it.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now