Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: The type or namespace name - could not be Post Reply Post New Topic
Author Message
kwjohns
Newbie
Newbie


Joined: 02 Nov 2010
Online Status: Offline
Posts: 4
Quote kwjohns Replybullet Topic: The type or namespace name - could not be
     Posted: 27 Jun 2012 at 7:24am
Visual Studio 2005
Crystal Reports 2008 (12.4.0.966)

Trying to build my project which has a pdf that will be created via Crystal Reports. Getting the following error:


Error 1 The type or namespace name 'PrintPDF' could not be found (are you missing a using directive or an assembly reference?)


Line causing the error:

using (PrintPDF reportPrint = new PrintPDF())
{
...
}



The Crystal Report file is named PrintPDF.rpt.

I have the following references (that were added automatically upon creating an .rpt file):

CrystalDevisions.CrystalReports.Engine
CrystalDevisions.Enterprise.Framework
CrystalDevisions.Enterprise.InfoStore
CrystalDevisions.ReportSource
CrystalDevisions.Shared

My .cs file has the following at the top:

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

Any ideas what is causing the error?      
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Jun 2012 at 3:24am
I believe that you create a new CR instance and assign it the value of the report
IP IP Logged
kwjohns
Newbie
Newbie


Joined: 02 Nov 2010
Online Status: Offline
Posts: 4
Quote kwjohns Replybullet Posted: 28 Jun 2012 at 4:04am
Originally posted by lockwelle



I believe that you create a new CR instance and assign it the value of the report


I'm using the same code in another project and it's building fine. To further show what's going on here, I have created a new .rpt (CrystalReport1.rpt) file in the project and I'm able to get it to recognize that file (along with the CrystalReportBillDetail.rpt and CrystalReportBillSummary.rpt files), however it doesn't recognize my PrintPDF.rpt or PrintPDFMulti.rpt files.

CR files:


CrystalReport1.rpt recognized:


PrintPDF.rpt (or PrintPDFMulti.rpt) not recognized:

IP IP Logged
kwjohns
Newbie
Newbie


Joined: 02 Nov 2010
Online Status: Offline
Posts: 4
Quote kwjohns Replybullet Posted: 28 Jun 2012 at 6:17am
Upon further investigation, the reason that this isn't working is because my .rpt files aren't auto-generating anything in their .cs files. They're simply empty. So it's missing things like:

public class CrystalReportBillSummary : ReportClass {

        public CrystalReportBillSummary() {
        }


How do I get the .cs files to auto-generate like they're supposed to?
IP IP Logged
kwjohns
Newbie
Newbie


Joined: 02 Nov 2010
Online Status: Offline
Posts: 4
Quote kwjohns Replybullet Posted: 28 Jun 2012 at 9:33am
Problem fixed. .cs files weren't generating due to group headers being empty after updating datasource.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum